본문 바로가기

react

[React] 경고문 fix Selector unknown returned the root state when called. This can lead to unnecessary rerenders. Selector unknown returned the root state when called. This can lead to unnecessary rerenders. Selectors that return the entire state are almost certainly a mistake, as they will cause a rerender whenever *anything* in state changes. 회사에서 리액트로 개발하던 도중 항상 이 경고문이 신경쓰였다. 여기 온 사람들도 모두 나와 같은 생각일 것이다. 결론부터 말하자면, const state = useSelector(state=>state); 위에 원인이 되었던 코드를 const Mode = useSelector(state=>sta.. 더보기
리액트 설치 A to Z 1. vsCode 설치 - 개발시에 코드를 메모장=>전문적 메모장으로 쓸 수 있다. https://code.visualstudio.com/ Visual Studio Code - Code Editing. Redefined Visual Studio Code is a code editor redefined and optimized for building and debugging modern web and cloud applications. Visual Studio Code is free and available on your favorite platform - Linux, macOS, and Windows. code.visualstudio.com 2. node js 설치 - 간혹 보이는 npm npx 등등 j.. 더보기
React 반응형으로 창 크기 조절(비율 고정) const root = ReactDOM.createRoot(document.getElementById('root')); root.render( ); -리액트는 기본적으로 이 root란 id를 가진 요소에 그림을 그린다(본문과 다르더라도 너께 맞다 맞다). -그렇기에 이렇게 바꾸어도 root안에서 렌더링이 가능하단 뜻이 된다. -이제 css 설정을 해야한다, 이제부터 잘 따라오도록 한다. html{ height: 100%; background-color: black; } body { background-color: black !important; width: 100%; height: 100%; position: relative; display: flex; align-items: center; justify.. 더보기