๐ค ์์งlog ๐ค
[SelectBox] ์ต์ ์/์ค๋๋์ ์ ๋ ฌํ๊ธฐ ๋ณธ๋ฌธ
<SelectWrap>
<Select onChange={handleSort} id="select">
<option value="desc">์ต์ ์</option>
<option value="asc">์ค๋๋์</option>
</Select>
</SelectWrap>
๋ฐ์ดํฐ๋ฅผ ์ค๋ฆ์ฐจ์(ASC)์ด๋ ๋ด๋ฆผ์ฐจ์(DESC)์ผ๋ก ์ ๋ ฌ : Default๊ฐ์ Ascending(์ค๋ฆ์ฐจ์)
// map ํจ์ ์
.sort((a: Type, b: Type) =>
sort === "asc" ? a.id - b.id : b.id - a.id,
)
.map
728x90
'๐ฅ TIP' ์นดํ ๊ณ ๋ฆฌ์ ๋ค๋ฅธ ๊ธ
[NextJS] Warning: Function components cannot be given refs. Attempts to access this ref will fail. Did you mean to use React.forwardRef()? (0) | 2023.03.26 |
---|---|
[Git] ๊น๋ฉ(GitLab) ์ฌ์ฉํ๊ธฐ (0) | 2023.03.24 |
[Git] branch ์์ฑ ๊ณผ ์ ํ ๋ฐฉ๋ฒ (0) | 2022.12.06 |
์ปค๋งจ๋ ๋ผ์ธ (Command Line Interface) (0) | 2022.11.03 |
[GIT] Github Repository ๋ค์ด๋ฐ ์ปจ๋ฒค์ (0) | 2022.10.31 |