๋ชฉ๋ก์ ์ฒด ๊ธ (115)
let's get IT with DAVINA ๐ป
![](http://i1.daumcdn.net/thumb/C150x150/?fname=https://blog.kakaocdn.net/dn/bUIqZu/btrYSpBq4bA/G51rvlmpbJH8WEljDBusj0/img.png)
Pre-Knowledge ๊ฐ์ฒด ์งํฅ ํ๋ก๊ทธ๋๋ฐ(Object Oriented Programming) ⇒ ๊ฐ์ฒด์ ์ ์ฅ์์ ๋ณด๋๊ฒ!!! ์ฌ๋์ด ์ธ๊ณ๋ฅผ ๋ณด๊ณ ์ดํดํ๋ ๋ฐฉ๋ฒ์ ํ๋ด ๋ธ ํ๋ก๊ทธ๋๋ฐ ๋ฐฉ๋ฒ๋ก ์ค ํ๋ ⇒ ํ์ค ์ธ๊ณ๋ฅผ ๊ธฐ๋ฐ์ผ๋ก ํ๋ก๊ทธ๋๋ฐ ๋ชจ๋ธ์ ๋ง๋ค ๋์ ์ ์ฉํ๋ค! “ํด๋์ค”๋ผ๊ณ ๋ถ๋ฆฌ๋ ๋ฐ์ดํฐ ๋ชจ๋ธ์ ์ฒญ์ฌ์ง์ ์ด์ฉํด ์ฝ๋ ์์ฑ โญ 4๊ฐ์ง ์ฃผ์ ๊ฐ๋ 1. Encapsulation(์บก์ํ) : ๋ฐ์ดํฐ์ ๊ธฐ๋ฅ์ ํ๋์ ๋จ์๋ก ๋ฌถ๋ ๊ฒ 2. Inheritance(์์) : ๊ธฐ๋ณธ ํด๋์ค์ ํน์ง์ ํ์ ํด๋์ค๊ฐ ์์๋ฐ๋๋ค. (๋ถ๋ชจ/์์) 3. Abstraction(์ถ์ํ) : ๋ด๋ถ ๊ตฌํ์ ์์ฃผ ๋ณต์กํ๋ฐ, ์ค์ ๋ก ๋ ธ์ถ๋๋ ๋ถ๋ถ์ ๋จ์ํ๊ฒ ๋ง๋ ๋ค๋ ๊ฐ๋ 4. Polymorphism(๋คํ์ฑ) : ๋๊ฐ์ ๋ฉ์๋์ฌ๋ ๋ค๋ฅธ ..
![](http://i1.daumcdn.net/thumb/C150x150/?fname=https://blog.kakaocdn.net/dn/cEWimZ/btrYI9LaUmS/d0fczb2vtcLKt8Pf5uSFH0/img.png)
Call Signatures ๋ง์ฐ์ค๋ฅผ ๊ฐ๋ค ์ฌ๋ ค๋ณด๋ฉด ์์ ๋จ๋ ์ ๋ฐ์ค ํจ์์ ์ธ์ type ์ ์ + return type ์ ์ Type์ ๋จผ์ ์ ์ํ ๋ค -> ํจ์/์ฝ๋๋ฅผ ๊ตฌํํ์ instead of ํจ์๋ฅผ ๊ตฌํํ๋ฉด์ ๋์์ type์ ์ ์ํ๋ ๊ฒ๋ณด๋ค better //type ๋ฏธ๋ฆฌ ์ ์ type Add = (a:number, b:number) => number const add:Add = (a,b) => a+b //instead of const add = (a:number, b:number) => a+b Overloading ํจ์๊ฐ ์ฌ๋ฌ ๊ฐ์ call signatures๋ฅผ ๊ฐ์ง๊ณ ์์ ๋ ๋ฐ์ ๋ด๊ฐ ์ง์ ์ธ ์ผ์ ๊ฑฐ์ ์์ง๋ง, ์ธ๋ถ ํจํค์ง๋ ๋ผ์ด๋ธ๋ฌ๋ฆฌ๋ฅผ ์ฌ์ฉํ ๋ ๋ง์ด ๋ณผ ์ ์๊ธฐ ๋๋ฌธ์ ์์๋์! t..
![](http://i1.daumcdn.net/thumb/C150x150/?fname=https://blog.kakaocdn.net/dn/bRrALp/btrYycWW6Sd/p1DbROUEQo5RKe7uC8ne1K/img.png)
Redux๋? ์ํ ๊ด๋ จ ๋ผ์ด๋ธ๋ฌ๋ฆฌ ์ ์ญ ์ํ๋ฅผ ๊ด๋ฆฌํ ์ ์๋ Store์ ์ ๊ณตํจ์ผ๋ก์จ ํ๊ธฐ์ ๊ฐ์ ๋ฌธ์ ํด๊ฒฐ ์ปดํฌ๋ํธ์ ์ํ๋ฅผ ๋ถ๋ฆฌํ๋ ํจํด Redux์ ๊ธฐ๋ณธ ๊ตฌ์กฐ ์ํ๊ฐ ๋ณ๊ฒฝ๋์ด์ผ ํ๋ ์ด๋ฒคํธ๊ฐ ๋ฐ์ํ๋ฉด, ๋ณ๊ฒฝ๋ ์ํ์ ๋ํ ์ ๋ณด๊ฐ ๋ด๊ธด Action ๊ฐ์ฒด๊ฐ ์์ฑ๋ฉ๋๋ค. ์ด Action๊ฐ์ฒด๋ Dispatch ํจ์์ ์ธ์๋ก ์ ๋ฌ๋ฉ๋๋ค. Dispatch ํจ์๋ Action ๊ฐ์ฒด๋ฅผ Reducer ํจ์๋ก ์ ๋ฌํด์ค๋๋ค. Reducerํจ์๋ Action ๊ฐ์ฒด์ ๊ฐ์ ํ์ธํ๊ณ , ๊ทธ ๊ฐ์ ๋ฐ๋ผ ์ ์ญ ์ํ ์ ์ฅ์ Store์ ์ํ๋ฅผ ๋ณ๊ฒฝํฉ๋๋ค. ์ํ๊ฐ ๋ณ๊ฒฝ๋๋ฉด, React๋ ํ๋ฉด์ ๋ค์ ๋ ๋๋ง ํฉ๋๋ค. ์ฆ, Redux์์ Action→Dispatch→Reducer→Store ์์๋ก ๋ฐ์ดํฐ๊ฐ ๋จ๋ฐฉํฅ์ผ๋ก ํ๋ฅด๊ฒ ๋ฉ๋๋ค...
export const ImgBox = styled.div` background-image: ${(props) => `url(${props.img})`}; background-size: cover; background-position: center; height: 20rem; border-radius: 1rem; position: relative; `; โ๏ธ Error Issue background-image๋ง ์คฌ๋๋ ์ฌ์ง์ ์ ์ฒด ์ด๋ฏธ์ง๊ฐ ๋ด๊ธฐ์ง ์์์ background-size:cover & background-position: center๋ฅผ ์ถ๊ฐํ์ฌ ์ด๋ฏธ์ง๊ฐ div์ ์ฌ์ด์ฆ์ ๋ฑ ๋ง๊ฒ ๋ฐฐ์น๋จ
![](http://i1.daumcdn.net/thumb/C150x150/?fname=https://blog.kakaocdn.net/dn/cFke6B/btrYByKSQJI/r2RB8Bq2fe4NH4uzQF7OF0/img.png)
try { await axios({ method: "post", url: `/member/wishlists?hotelId=${id}`, headers: { Authorization: localStorage.getItem("accessToken"), }, }); await axios.post(`/member/wishlists?hotelId=${id}`, undefined, { headers: { Authorization: localStorage.getItem("accessToken"), }, }); } catch (error) { console.error(error); } ๐ซ Error Issue wishlist (ํํธ๋ฅผ ๋๋ฅด๋ฉด ์ฐ๊ธฐ๋ฅ) ์ฒ์์ await axios.post( /member/wishlist..
![](http://i1.daumcdn.net/thumb/C150x150/?fname=https://blog.kakaocdn.net/dn/dadGw9/btrYDfKUHTQ/sfVGZYNfiBbiNJUyrNtw90/img.png)
2023/2/2~2023/2/28 ๊น์ง ์ด ๋ช๋ฐ์ผ๊น? export const getDateDiff = (d1, d2) => { if (d1 !== null && d2 !== null) { const date1 = new Date(d1); const date2 = new Date(d2); const DateDiff = date1.getTime() - date2.getTime(); return Math.abs(DateDiff / (1000 * 60 * 60 * 24)); } }; //์ ์ฉ์? {getDateDiff(checkin, checkout)}๋ฐ
![](http://i1.daumcdn.net/thumb/C150x150/?fname=https://blog.kakaocdn.net/dn/cnQobR/btrYAajpL2H/UCFiLmrguoEVCcfvUVPcKK/img.jpg)
window.open(์์ฐฝ ์ด๊ธฐ) ์น๋ธ๋ผ์ฐ์ ์์ ์์ฐฝ(ํ์ ์ฐฝ) ์ด๊ธฐ window.open('ํ์ ์ฃผ์', 'ํ์ ์ฐฝ ์ด๋ฆ', 'ํ์ ์ฐฝ ์ค์ '); window.open(url, name, option); window.open( res.data.url, "์นด์นด์คํก ๊ฒฐ์ ", "top=100px, left=100px height=800px, width=500px" ); url ์์ฐฝ(ํ์ ์ฐฝ)์ ๋ณด์ฌ์ง ์ฃผ์, ๊ธฐ๋ณธ๊ฐ: blank ⇒ ๋น ์ฐฝ์ด ๋ณด์ name ์๋ก ์ด๋ฆด ์ฐฝ์ ์ด๋ฆ ๋๋ ์์ฑ ์ง์ ๊ธฐ๋ณธ๊ฐ: _blank (์ ์ฐฝ์ผ๋ก ์ฐ๋ค) _parent: ๋ถ๋ชจ ํ๋ ์์ ์ด๋ฆฐ๋ค. _self: ํ์ฌ ํ์ด์ง๋ฅผ ๋์ฒดํ๋ค. _top: ๋ก๋๋ ํ๋ ์์ ์ ๋์ฒดํ๋ค. _name(์์์ ์ด๋ฆ): ์ ์ฐฝ์ด ์ด๋ฆฌ๊ณ ์ฐฝ์ ์ด๋ฆ ์ง์ option ..
const ReviewContent = styled.div` text-overflow: ellipsis; //๋ง ์ค์ํ ์๋ต๊ธฐํธ overflow: hidden; //๋์ด๊ฐ ๋ถ๋ถ(๊ธ์) ์๋ณด์ฌ์ฃผ๊ธฐ white-space: nowrap; //์ฌ๋ฌ์ค ์๋ณด์ด๊ฒ ํ๊ธฐ `; return ( {review.content} {review.content.length >= 30 ? ( ๋๋ณด๊ธฐ {openModal ? ( ) : null} ) : ( "" )} )