반응형
    
    
    
  250x250
    
    
  
                              Notice
                              
                          
                        
                          
                          
                            Recent Posts
                            
                        
                          
                          - Today
- Total
DATA101
[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."
DATA101 2022. 7. 1. 18:05728x90
    
    
  반응형
    
    
    
  ❗️에러 상황
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
    
    
  반응형
    
    
    
  'SW 개발 > React JS' 카테고리의 다른 글
| [React] 404 Not Found 의미와 리턴 페이지 만드는 방법 (0) | 2022.07.19 | 
|---|---|
| [React] 숫자 자릿수마다 콤마 붙이는 방법 (0) | 2022.07.05 | 
| [React] 버튼 자동 클릭/2번 클릭 방지하는 방법 (0) | 2022.06.30 | 
| [React] 에러 해결: "img elements must have an alt prop, either with meaningful text, or an empty string for decorative images jsx-a11y/alt-text" (0) | 2022.06.30 | 
| [React] 에러 해결: "Warning: Each child in a list should have a unique "key" prop." (0) | 2022.06.30 | 
 
                   
                   
                  