How can I define default values in ReactJS?
var Header = React.createClass({
render: function() {
return (
<h1>{this.props.title} if not defined insert "Title"</h1>
)
}
});
I extremely increased my React skill and as of 2018 this example (I wrote at the question body) is outdated. You should do it like @VladyVeselinov shown at the picture using ES6 classes and babel transforms like babel-class-properties that allow you to make static fields for your components
Reactskill and as of 2018 this example (I wrote at the question body) is outdated. You should do it like @VladyVeselinov shown at the picture using ES6 classes and babel transforms likebabel-class-propertiesthat allow you to makestaticfields for your components