Error: Objects are not valid as a React child (found: object with keys {$$typeof, render, attrs, componentStyle, displayName, shouldForwardProp, foldedComponentIds, styledComponentId, target, withComponent, warnTooManyClasses, toString}). If you meant to render a collection of children, use an array instead.
react를 실행했는데 해당 에러가 나온다면?
react child에 무슨 에러가 생긴것이다.
다양한 이유가 있겠지만 나같은 경우는 styled-component 사용에서 실수하여 에러가 발생하였다.
const HeaderLink = styled(Link);
export default () => {
return (
<HeaderLink/>
);
}
위 코드의 문제점은 아주 간단하게도
const HeaderLink = styled(Link)``;
export default () => {
return (
<HeaderLink/>
);
}
``를 빼먹고 사용했었다..
에러가 저 특정 파트를 가리키지 않고, 전체적인 reactDOM에러를 반환하니 찾기가 어려웠다.
'개발 > Web Programming' 카테고리의 다른 글
[React] BrowserRouter 란? (0) | 2020.09.04 |
---|---|
Redux, Context API란? (0) | 2020.09.03 |
[React] withRouter를 사용하는 이유 (0) | 2020.08.31 |
'React' must be in scope when using JSX react/react-in-jsx-scope (0) | 2020.08.31 |
React useState에 관하여 (0) | 2020.08.30 |