Recent Posts
Recent Comments
Archives
반응형
250x250
«   2024/05   »
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 31
Today
Yesterday

Total
05-14 01:06
관리 메뉴

Hey Tech

[React] 에러 해결: "Functions are not valid as a React child. This may happen if you return a Component instead of <Component /> from render. Or maybe you meant to call this function rather than return it." 본문

SW 개발/React JS

[React] 에러 해결: "Functions are not valid as a React child. This may happen if you return a Component instead of <Component /> from render. Or maybe you meant to call this function rather than return it."

Tony Park 2022. 7. 1. 18:05
728x90
반응형

❗️에러 상황

return에서 아래와 같이 코드 작성 후 실행 시 에러 발생

return (
    <div>
      {function}
    </div>
)

📝에러 메시지

Functions are not valid as a React child. This may happen if you return a Component instead of <Component /> from render. Or maybe you meant to call this function rather than return it.

에러 메시지

✅해결책

다음과 같이 함수명 뒤에 괄호 붙여주면 해결됩니다.

return (
    <div>
      {function()}
    </div>
)

포스팅 내용에 오류가 있다면 아래에 댓글 남겨주세요.

그럼 오늘도 즐거운 하루 보내시길 바랍니다 :)

고맙습니다😊

728x90
반응형
Comments