Join Eve Porcello for an in-depth discussion in this video Setting properties, part of Learning React.js.
- [Woman] In this video we want to use the component…life cycle to set properties.…First let's remove some content from our index.html file…and the first thing I wanna remove here…is everything about getting rid of the box,…I'll remove component did mount and will mount,…and then I'm going to add a new method here called…getDefaultProps.…Get default props will be called once before the component…renders to set up defaults for our component.…
So in this method we're actually going to handle…all of our styling via getDefaultProps…rather than this style tag.…So we want to return an object that passes all of this…information about our desired style.…So let's go ahead and cut and paste this…directly into our return statement.…Let's also remove our style tag…since we aren't going to need that anymore,…and we're going to make a few little adjustments…here to the object being returned.…
Number one, we wanna replace our hyphenated background…color with camelcase.…We want to make blue a string, we want to remove pixels…and just pass in numerical value for height and width,…
- What is React.js?
- Introducing JSX
- Creating a React component
- Handling events
- Using state
- Working with PropTypes
- Adding child elements
- Mounting and updating components
- Creating a React.js app
Skill Level Beginner
Building a Web Interface with React.jswith Ray Villalobos1h 21m Intermediate
1. What Is React.js?
2. Getting Started
3. React Components
4. Props and State
5. Enhancing Components
6. Creating an App
Using create-react-app4m 38s
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?
This will not affect your course history, your reports, or your certificates of completion for this course.Cancel
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.
Notes are saved with you account but can also be exported as plain text, MS Word, PDF, Google Doc, or Evernote.