[Typescript] TS2339: Property 'children' does not exist on type '{}'.
2023. 7. 12. 22:31
개발/Error note
const TodosContextProvider: React.FC = (props) => { ...코드생략 return ( {props.children} ); }; 강의를 따라하는데 props.children 은 따로 명시를 해주지 않아도 children이 자동으로 있다고 그냥 쭉쭉 진도나가는데 나는 자꾸 존재하지 않는다고 떴다. 시도1const TodosContextProvider: React.FC = (props) => { ...코드생략 return ( {props.children} ); };그래서 FC에 제네릭으로 빈 객체를 넣어줘봤다. 응 그래도 빨간줄 시도2type Props = { children: React.ReactNode; }; const TodosContextProvider: React..
[React] '파일명' cannot be used as a JSX component. Its return type 'Element | undefined' is not a valid JSX element. Type 'undefined' is not assignable to type 'Element | null'.
2023. 7. 11. 08:17
개발/Error note
실행 시 자꾸 위와 같은 오류가 떴다. '파일' cannot be used as a JSX component. Its return type 'Element | undefined' is not a valid JSX element. Type 'undefined' is not assignable to type 'Element | null'. 오류는 말그대로 JSX엘리먼트를 반환하고있지 않다는말이었다. const GameMatcher = () => { const params = useParams() if (!params) { return 일치하는 게임이 없습니다 } if (params.name === "number-baseball") { return } else if (params.name === "rock-s..
[Webpack] Set 'mode' option to 'development' or 'production' to enable defaults for each environment.
2023. 6. 1. 20:51
개발/Error note
Set 'mode' option to 'development' or 'production' to enable defaults for each environment. npx webpack 으로 웹팩 실행 시 위와 같은 에러가 발생했다. 파일명 오타 ^^.. 하고 다시 npx webpack 을 하는데 TS18002: The 'files' list in config file 'tsconfig.json' is empty. 라는 에러가 발생했다. 응 또 오타.. 파일명을 제대로하니 Meterial Icon 익스텐션 로고도 제 할일을 찾았고 터미널에서도 잘 작동됐다. 진짜 오타왕 이나당..