[react] default props value
React에서는 props의 value를 따로 쓰지 않으면 boolean으로 보게 되어 있다.
(html5에서는 특정 attribute만 boolean을 갖는다.)
Default Props
class App extends React.Component {
render() {
return <MyComponent hasButton/>;
}
}
// MyComponent내에서 this.props.hasButton은 true가 된다.
Ref
Docs: https://reactjs.org/docs/jsx-in-depth.html#props-default-to-true
Html5: https://developer.mozilla.org/en-US/docs/Web/HTML/Attributes#boolean_attributes
Author And Source
이 문제에 관하여([react] default props value), 우리는 이곳에서 더 많은 자료를 발견하고 링크를 클릭하여 보았다 https://velog.io/@devstefancho/react-default-props-value저자 귀속: 원작자 정보가 원작자 URL에 포함되어 있으며 저작권은 원작자 소유입니다.
우수한 개발자 콘텐츠 발견에 전념 (Collection and Share based on the CC Protocol.)