[react] default props value
Reactでは、propsのvalueを単独で使用しない場合はbooleanとします.
(html 5では、booleanを持つのは特定の属性のみです.)
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
(html 5では、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
Reference
この問題について([react] default props value), 我々は、より多くの情報をここで見つけました https://velog.io/@devstefancho/react-default-props-valueテキストは自由に共有またはコピーできます。ただし、このドキュメントのURLは参考URLとして残しておいてください。
Collection and Share based on the CC Protocol