Notice
Recent Posts
Recent Comments
Link
일 | 월 | 화 | 수 | 목 | 금 | 토 |
---|---|---|---|---|---|---|
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 |
Tags
- github io
- fetch
- getModifierState
- 컨디셔널 렌더링
- API token
- typescript react
- bootstrap
- There isn’t anything to compare
- icon
- react env
- react
- next.js css
- ngrok설치
- nextjs .env
- Git
- dart 변수
- ngrok실행
- createGlobalStyle
- nextjs
- git lab
- input type=file
- SCSS
- API 토큰
- github
- rewrites
- styled components
- react typescript
- npm styled-reset
- CSS
- nextjs 설치
Archives
- Today
- Total
목록react prop type (1)
꾸준히 성장하는 개발자

react에서는 props의 데이터 타입을 잘못 입력해도 문법상 문제가 없다면 에러메시지 없이 화면 출력이 된다 function App() { return ( ); } const root = document.getElementById("root"); ReactDOM.render(, root); text prop에는 string으로 써야 하고 fontSize prop에는 숫자로 작성을 해야 하는데 이렇게 작성이 되어도 react에서는 오류로 인지하지 못하고 화면에 출력이 되게 된다. 이런 경우에 이런 실수를 막을 수 있도록 하는 방법이 props type이다 이걸 위에 추가해주고 Btn.propTypes = { text: PropTypes.string, fontSize: PropTypes.number, }..
React
2022. 2. 28. 06:44