The ability to reply to discussions is limited to PRO members. Want to join in the discussion? Click here to subscribe now.

Building a React.js App - ES6 Refactor: propTypes in ES6

Building a React.js App - ES6 Refactor: propTypes in ES6

2:50
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.
Watch this lesson now
Avatar
egghead.io

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.

Avatar
egghead.io

The lesson video has been updated!

Avatar
Cameron Roe

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
};
Avatar
Sergei

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.

HEY, QUICK QUESTION!
Joel's Head
Why are we asking?