Created
June 20, 2016 06:45
-
-
Save tigerraj32/384236952f004fd969e2b46e5ddc2e74 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
var ComponentWithDefaultProps = React.createClass({ | |
getDefaultProps: function() { | |
return { | |
value: 'default value' | |
}; | |
} | |
}); | |
------------------ or the other way ---------------------- | |
ComponentWithDefaultProps. defaultProps = { | |
value:'default value', | |
} | |
class ComponentWithDefaultProps extends Component { | |
render(){ | |
return( | |
<h1>{this.props.val}</h1> | |
); | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment