FRONTEND7 Zustand로 상태관리 하기 리액트는 독립적인 컴포넌트 단위로 구성되어 있습니다. useState hook을 사용하여 하나의 컴포넌트에서 상태를 관리하고 props를 통해 부모-자식 간에 상태를 전파할 수 있습니다.상태가 시작된 지점과 어떤 컴포넌트를 거쳐가는지, 모든 흐름을 이해하고 기억한다면 useState와 props를 사용하는데 무리가 없지만 프로젝트의 규모가 커짐에 따라 관리해야 할 상태의 개수가 늘어납니다. 그렇기 때문에 상태관리 툴을 사용해 효율적으로 상태를 관리할 필요가 있습니다. 상태관리를 위한 툴은 Redux, Context API, React Query, Recoil, Jotai, Zustand 등이 널리 사용되고 있다.Recoil과 Jotai는 Context, Provider 그리고 Hook을 기반으로 가능한.. 2024. 5. 28. [Error] JSX element implicitly has type 'any' because no interface 'JSX.IntrinsicElements' exists. VSCode를 사용하면 제목과 같은 에러가 발생합니다. 실행은 되는데 에디터상에 빨간 줄이 표시되니 눈에 영~ 거슬립니다. 저 같은 경우는 리액트 버전이 낮아서 발생하는 문제여서 최신버전으로 업데이트해서 해결했습니다. $ npm install --save-dev @types/react@latest @types/react-dom@latest $ npm install react@latest react-dom@latest 2024. 2. 4. 오류! yarn update(upgrade) yarn을 설치하고 프로젝트를 생성하면 이런저런 warning이 출력됩니다. yarn create react-app $ yarn create react-app test-app yarn create v1.22.21 [1/4] Resolving packages... [2/4] Fetching packages... [3/4] Linking dependencies... [4/4] Building fresh packages... success Installed "create-react-app@5.0.1" with binaries: - create-react-app [####################################################################] 68/68 Creatin.. 2024. 1. 3. 오류! 프로젝트 생성 후 .yarn 폴더가 생성되지 않을 때 $ yarn create react-app app1 명령어로 프로젝트를 생성할 경우 .yarn 폴더가 생성되지 않은 경우가 있습니다. 그럴 경우에는 yarn 버전을 다시 설정해 주면 해결됩니다. ❯ yarn -v 1.22.21 ❯ yarn set version stable ➤ YN0000: Retrieving https://repo.yarnpkg.com/4.0.2/packages/yarnpkg-cli/bin/yarn.js ➤ YN0000: Saving the new release in .yarn/releases/yarn-4.0.2.cjs ➤ YN0000: Done in 0s 225ms ❯ ❯ yarn -v 4.0.2 > ls app1/ ❯ rm -rf app ❯ yarn create react-app.. 2024. 1. 2. 오류! 설치 후 프로젝트에서 코드 수정 시 오류 프로젝트를 생성하고 "yarn start"로 프로그램을 실행해 봅니다. 실행 후 예를 들면 src/App.js 파일을 수정하면 브라우저에 아래와 같은 오류 메시지가 표시됩니다. create-react-app과 yarn이 충돌해서 발생하는 현상입니다. 프로젝트에서는 아래와 같은 메시지가 출력되네요. Failed to compile. [eslint] Failed to load config "react-app" to extend from. Referenced from: /home/user/programming/react/basic/package.json ERROR in [eslint] Failed to load config "react-app" to extend from. Referenced from: /ho.. 2023. 3. 25. yarn 설치 시 오류 yarn을 사용하려면 node.js를 설치한 후 아래 명령어를 실행합니다. $ corepack enable 그리고, yarn을 최신 버전으로 업데이트합니다. $ yarn set version stable 정상적으로 설치했음에도 불구하고 아래와 같은 오류가 발생하는 경우가 있습니다. $ yarn create react-app basic ➤ YN0000: ┌ Resolution step ➤ YN0061: │ tar@npm:2.2.2 is deprecated: This version of tar is no longer supported, and will not receive security updates. Please upgrade asap. ➤ YN0000: └ Completed in 1s 499ms ➤ Y.. 2022. 12. 20. 이전 1 2 다음