반응형
Notice
Recent Posts
Recent Comments
일 | 월 | 화 | 수 | 목 | 금 | 토 |
---|---|---|---|---|---|---|
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
- 리액트
- 제이쿼리
- Python
- Dunk Low
- sacai
- 주식공부
- Linux
- 주식
- 코로나19
- react
- 자바스크립트
- 덩크 하이
- 나이키
- dunklow
- Nike
- GIT
- 리눅스
- stockx.com
- draw
- Github
- 드로우
- 발매예정
- dunk high
- 덩크 로우
- jQuery
- JavaScript
- 오라클
- oracle
- 파이썬
- 덩크로우
Archives
- Today
- Total
Life goes slowly...
[React] Expected `onClick` listener to be a function, instead got `false` 에러 본문
프로그래밍/React.js
[React] Expected `onClick` listener to be a function, instead got `false` 에러
빨강소 2022. 5. 9. 11:33728x90
반응형

Expected `onClick` listener to be a function, instead got `false` Error 발생
Warning: Expected `onClick` listener to be a function, instead got `false`.

React Component에서 Button 등과 같은 이벤트 발생 후에 특정한 함수인 function을 호출하려 할 때에 발생하는 Error입니다. 이는 정상적으로 호출은 되긴 하지만 React의 Console창에서 경고인 오류를 보이게 됩니다.
//잘못된 코드
<button onClick={condition && value}>
Click
</button>
//수정된 코드
<button onClick={condition ? value : undefined}>
Click
</button>
728x90
반응형
'프로그래밍 > React.js' 카테고리의 다른 글
[React] react.js의 HTML <a> 태그 관련 에러 (0) | 2022.07.06 |
---|---|
[React] react.js의 HTML img 태그 관련 에러 (0) | 2022.07.05 |
[React] Invalid DOM property `for`. Did you mean `htmlFor`에러 (0) | 2022.05.12 |
[React] React.js 의 popup창에서 부모창의 함수 호출 (0) | 2022.04.19 |
[React] React.js 의 debounce 함수 (0) | 2022.02.23 |
[React] React.js 의 JSX 문법 (0) | 2022.02.22 |
[React] Each child in a list should have a unique "key" 에러 (0) | 2022.02.17 |
[React] <input> cannot appear as a child of <table>. 에러 (0) | 2022.02.15 |