프로그래밍/React
-
[제로초 Slack 클론 코딩] 백엔드 준비 + 초기설정 (Day-1)프로그래밍/React 2023. 9. 29. 15:09
백엔드 준비과정과 관련되어서는 안되면 다시 한번 영상을 보는 것이 좋을 것 같다. 처음 초기설정 및 세팅을 수동으로함으로써 어떠한 부분이 어떠한 역할을 하는지 알 수 있었다. 아래 내용은 그 중 궁금한 사항 및 새롭게 알게 된 내용을 간단히 정리해보았다. 1. package.json vs package.lock.json package.json은 라이브러리를 설치하게 되면 dependencies에 추가되게 되는데 이와 관련되어서 dependencies에 추가 된 라이브러리가 사용하고 있는 또 다른 라이브러리에 대해서 package.lock.json에 나타나게 된다 => 부모와 자식같다고 생각함 될 것 같다. 연관성 많고 package.lock.json 없으면 안되겠다는 생각이 들고 이거는 엄청 길어질것 같..
-
[은버지 Study] React-query에 대하여프로그래밍/React 2023. 7. 31. 01:34
react-query를 사용해야 하는 이유는 뭘까? 없다면 어떻게 비동기 state를 관리를 할까? useEffect로 비동기처리를 할려 생각하고 API를 가져와서 useState로 선언한 곳에 넣어주고 오류를 처리하는 작업도 따로 해주어야하는 번거롭고 boiler plate가 많이 일어나는 일을 거쳐야 한다. 이렇게 복잡한 것 말고 데이터 가져오고 관리하고 캐싱하고 하는 React-query한번 써보자 1. 기본 설정, Devtools, Options React Query의 설치 및 초기 설정 v3 npm install react-query yarn add react-query v4 (latest) $ npm i @tanstack/react-query $ pnpm add @tanstack/react-q..
-
[React] useRef 의 개념프로그래밍/React 2023. 7. 25. 02:31
useRef를 올바르게 쓰는 방법은 무엇일까? 먼저 useRef가 어떻게 작동하는지부터 알아보자 useRef란 current 객체를 반환하는 Hooks으로써 이렇게 한번 만들어진 current 객체는 랜더링이 발생해도 바뀌지 않고 고유한 값을 유지한다. 무수한 리랜더링 사이에서도 값을 유지해야하는경우 ex) infinite scroll의 식별객체 랜더링에 영향을 받지고 끼치지도 않는 특이한 녀석 ref의 변경은 감지되지도 않고 useEffect의 deps로도 사용할 수 없다 useRef의 초기값으로 null을 넣오도 되는 이유는? 이자식은 뭐하길래 null을 대부분의 초깃값으로 넣는 걸까? 객체가 선언되고 컴포넌트가 실행되고 평가가 진행되는 시점에서의 current객체는 null로 평가가 되기때문에 초기..
-
[유투브 어딘가] 통신에 관련된 영상을 잠깐보았다.프로그래밍/React 2023. 7. 18. 00:14
처음에는 JWT 토큰에 대한 내용을 찾아보다가 잘못들어 갔었다. 서버에 대해서 node.js들은 어떤식으로 구성하는지 보았는데 기억은 잘 안나지만 재밌어보였다. 클라이언트에서 서버로 요청을 할 때에 정보는 body 안에 넣어서 준다는 것을 알게되었다 fetch의 형식에 대해서 다시 한번 복습하는 기회가 되었다. fetch('서버주소').then((response)=>response.json()).then((data)=> console.log(data)); fetch를 사용할때에는 바디에 담아서 직렬화를 해준 다음에 보내준다. cors정책에 대해서 조금 더 알게되는 시간이 되었다 cross origin resorce sharing 에러가 난다면 어떻게 해결해야할까? client : 3000 개발서버 ser..