개념

개념/TypeScript(23.07.25~)

[Typescript] 구조분해할당 + 타입 어노테이션

함수 호출부에서 파라미터로 다음과 같이 넘겨줄 때, // Post const addMutation = useMutation(addChat, { onSuccess: () => { queryClient.invalidateQueries(["chats"]); // dB onsuccess시, 쿼리컨텍스트 속 stale data를 새것으로 교체해줘 }, }); ... addMutation.mutate({newMessage, fullName}); addChat 비동기함수가 정의된 부분에서의 파라미터는 : export const addChat = async ({ newMessage, fullName }: { newMessage: string; fullName: string }) => { const response = ..

개념/Javascript 메서드, 프로퍼티

[프로그래머스] reduce() 메서드

답안) // 풀이3 : reduce function solution(box, n) { return box.reduce((acc, v) => acc * Math.floor(v / n), 1); } 해설)

개념/TypeScript(23.07.25~)

[React] [TypeScript] [RTK-2] Typescript에서의 RTK

gpt, https://www.youtube.com/watch?v=I32ri7v3SYk 참고 +) 청크 까먹었다면, https://lethargin.tistory.com/193 참고 ❶ slice 파일 ❷ store.ts 파일 ❸ index.tsx 파일 (애플리케이션의 진입점) -provider 주입 -useDispatch(), useSelector() 등 불러와서, 컴포넌트 안에서 사용

개념/TypeScript(23.07.25~)

[Typescript] 헷갈리는 부분 복습

https://www.youtube.com/watch?v=FJDVKeh7RJI 1. type Person = { name: string; age?: number; // 되도록 ?은 지양 } let Person: Person = { name: "안진", } let lotsOfPeople: Person[]; //⭐️ [{Person1}, {Person2}, {Person3} ... { }] => let lotsOfPeople: Person[]; 는, { Person객체 }로 이루어져 있는 배열이라는 표현 2. type의 확장 3. interface의 확장 2, 3 복합 (type interface 끼리 융합) ❶ ❷

Lethargin
'개념' 카테고리의 글 목록