일 | 월 | 화 | 수 | 목 | 금 | 토 |
---|---|---|---|---|---|---|
1 | 2 | 3 | 4 | 5 | ||
6 | 7 | 8 | 9 | 10 | 11 | 12 |
13 | 14 | 15 | 16 | 17 | 18 | 19 |
20 | 21 | 22 | 23 | 24 | 25 | 26 |
27 | 28 | 29 | 30 |
Tags
- Nextjs React 18
- React 18 Nextjs
- React 고급 안내서
- React API 참고서
- next13 head
- notFound()
- Babel
- React18
- getUTCDate
- CSS
- Programmers
- hook
- React 공식문서
- RTK Query
- react-helmet
- Next13
- React 18
- Nextjs
- background setttimeout
- react hook
- background tab
- background setInterval
- background: url
- React 고급안내서
- react
- context
- Render Props
- Javascript
- 고급안내서
- codingtest
Archives
- Today
- Total
akjfal
Functions are not valid as a React child. This may happen if you return a Component instead of <Component /> from render. 본문
react/react 에러
Functions are not valid as a React child. This may happen if you return a Component instead of <Component /> from render.
akjfal 2019. 11. 23. 12:28
함수 호출을 잘 못 했을때 발생한다.
문제 예제)
import { Layout } from '../Component'
export function Main(){
const Bar = () => {
return (
<div>
App bar
</div>
)
}
return(
// <Layout Bar={Bar} /> // 문제 코드
<Layout Bar={<Bar>} /> // 정상 코드
...
)
}
Bar의 선언이 잘못되어 발생했다. 함수 선언이 제대로 되어있느닞 확인해보자