In this video, we’ll refactor our Repos and UserProfile components and along the way we’ll learn how to utilize propTypes in React with JavaScript classes.
The lesson video has been updated!
You can also add the propTypes as a static property on the class using the babel-preset-stage-0. For example:
static propTypes = {
username: React.PropTypes.string.isRequired,
notes: React.PropTypes.array.isRequired,
addNote: React.PropTypes.func.isRequired
};
Why didn't we change the this
references on the render methods to this.something().bind(this)
? I thought that this
didn't work using the class syntax when trying to reference things inside the Class from what you said on other videos.