In addition to the standard validation, there is custom validation that you can set up for propTypes. Usually custom validation involves if else statements. Eve sets this up for the SkiDayList to return errors if the SkiDayList isn't an array or if it has no values. You can also use custom validation to match regular expressions.
Let's continue our discussion about validation…by setting up property types for other components.…Then we're going to get into some custom validation.…The first step I want to take here is I'm going…to remove our createClass and ES6 files.…We no longer need those anymore,…so we can clean up that folder a little bit.…The next thing I want to do here is…in our SkiDayCount propTypes,…I'm going to add one other one for goal,…just to keep all of our bases covered there.…
In our Index.js file,…I'm going to uncomment our render method.…This should be uncommented.…We do want to render our SkiDayList from now on.…Let's go ahead and add PropTypes to our SkiDayRow.…The first step of this is to import PropTypes from react.…We're using resort, date, powder,…and backcountry again for this.…Let's go ahead and supply these.…SkiDayRow dot propTypes equals…resort: PropTypes dot string dot isRequired.…
- Refactoring elements with JSX
- Transpiling with Babel
- Creating components
- Adding component properties and methods
- Displaying child components
- Working with props and state
- Setting up routes
- Nesting routes
- Creating forms
- Understanding the component life cycle
Skill Level Intermediate
Building an App with React.js and MeteorJSwith Emmanuel Henri4h 20m Intermediate
Building a Polling App with Socket IO and React.jswith Alex Banks3h 56m Intermediate
1. What Is React.js?
2. Intro to JSX and Babel
3. React Components
4. Props and State
5. Using the React Router
6. Forms and Refs
7. The Component Lifecycle
Next steps1m 4s
- Mark as unwatched
- Mark all as unwatched
Are you sure you want to mark all the videos in this course as unwatched?
Take notes with your new membership!
Type in the entry box, then click Enter to save your note.
1:30Press on any video thumbnail to jump immediately to the timecode shown.