Join Eve Porcello for an in-depth discussion in this video Mounting components, part of Learn React.js: The Basics (2015).
- To better understand the component lifecycle functions,…let's open our index.html template…with the React framework…and the JSX transformer links.…We also, on line 10, are creating…a new component called Box.…And right now it is returning a div.…The first thing that we need to do…is we need to add a style for this div…so that we can actually see it.…So we will just add a style tag…to the head of our document.…And inside of this, we will create a style for div,…giving it a background color of blue,…a height of 200 pixels,…and a width of 200 pixels.…
Next, we want to add some lifecycle methods,…and we'll do this by triggering some simple alerts.…On line 18, I'm going to create a method…called componentWillMount.…This is going to be a function that will fire…right before our component mounts.…So in this function, we will create an alert that says…component is about to mount.…Great.…
Next we want to create another function…called componentDidMount.…Now componentDidMount acts much the same way,…but this will be invoked immediately…
- What is React.js?
- Introducing JSX
- Creating a React component
- Handling events
- Using state
- Defining parent/child relationships
- Adding child elements
- Mounting and updating components
- Creating a React.js app
Skill Level Beginner
Up and Running with AngularJS 1with Ray Villalobos1h 20m Intermediate
1. What is React.js?
2. Getting Started
3. React Components
4. Parent/Child Relationships
5. Component Life Cycle
6. Creating an App
Next steps1m 5s
- 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.