Coding127 React - next.js - styled components 셋팅 next js에서 styled components를 바로 적용한다면 다음과 같은 error가 발생한다. 이유는 SSR을 하는 next.js가 syled component를 먼저 못 읽어서 발생하는 문제이다. #object * next js styled-components setting 하기 ## setting - _app.tsx && _document.tsx 이 error 해결 하기위해서 _app.tsx 파일과 _document.tsx 파일을 custom 해야한다. // _app.tsx import type { AppProps } from "next/app"; import { ThemeProvider } from "styled-components"; import { theme } from "../styl.. 2022. 6. 24. React - material ui input element error react에서 material ui CheckBox element를 사용할 때, checked 속성 값에 boolean 이외 다른 값이 오면 다음과 같은 에러가 발생한다. "Material-UI: A component is changing the uncontrolled checked state of SwitchBase to be controlled." 이럴때, 설정 해놓은 값이 boolean 형태가 아닌 undefined나 null, string 값이 오면 controll 할 수 없다. 그래서 예외 처리를 해줘야한다. 설정해 놓은 값이 없을 경우 boolean을 넣을 수 있도록 2022. 4. 14. firebase - expo와 연동 react-native를 expo로 시작을 하고 firebase와 연동을 하려고 하면, 기존에 firebase web과 연결과 하는 방식과 다르게 진행을 해야한다. 아래와 같이 firebase를 셋팅을 하면 웹에서 firebase를 잘 받아올 수 있었다. # firebase - web 연동 config import { initializeApp } from "firebase/app"; import { getFirestore } from "firebase/firestore"; const firebaseConfig = { //... }; const app = initializeApp(firebaseConfig); const db = getFirestore(app); 하지만 expo를 활용하여 firebase와.. 2022. 4. 11. React Native - While trying to resolve module `@apollo/client` from file React Native에서 graphql을 setting을 하면서 While trying to resolve module `@apollo/client` from file error가 발생 할 수 있다. @apollo/client 버전이 3.5 이상이 되면서 .cjs 파일을 읽지 못해서 생기는 원인이다. 이것을 해결 하기 위해서는 root 디렉토리에 metro.config.js 파일을 만들고 다음과 같이 설정을 해주면 된다. const { getDefaultConfig } = require("metro-config"); const { resolver: defaultResolver } = getDefaultConfig.getDefaultValues(); exports.resolver = { ...defaul.. 2022. 4. 2. 이전 1 2 3 4 5 6 7 ··· 32 다음 반응형