I ported one of my applications to ES6 on node / react, and I have a question about how props are passed on to children. I read a bunch of posts, and some addresses are, others are not. Basically, what I have seen so far is:
export default class SomeComponent extends React.Component { constructor(props) { super(props); } render() { return ( <div> {this.props.text} <<< Props used here </div> ); } }
but I managed to get my component to work with the following:
export default class SomeComponent extends React.Component { constructor() { super(); <<< notice no props in parentheses } render() { return ( <div> {this.props.text} <<< Props used here </div> ); } }
Is there a reason why I should pass the props in parentheses to my constructor and super call? or I can leave my code as it is.
source share