A render prop is a way to share code between React components using a function property. The property defines what is rendered and the component injects it into the UI.
- [Narrator] A popular technique…when rendering React components…is to use a pattern called render props.…Now we got a little sneak preview of this…when we were looking at the context API.…A render prop is a way to share code…between React components using a function property.…The property defines what is rendered…and the component just injects it into the UI.…Now if that sounds a little weird, that's totally OK.…Let's take a look at it to understand a bit more detail.…You'll notice that we're starting out…with this display encouragement component being rendered…let's go ahead and create it.…
So we'll first create that display encouragement component…and we're just gonna stub this out for now.…This is going to return some sort of something.…Alright that's a little vague, right?…But here's what it'll actually return.…It's going to return this component called encouragement.…This is going to be another one of these…stateless components.…
This one should return a div…and then we're gonna render some data in that div…
- What's new in React 16
- Rendering arrays
- Controlled, uncontrolled, and compound components
- Using keyed fragments
- Working with new lifecycle methods
- React patterns
- Using the context API
- Checking for accessibility issues in your React code
Skill Level Advanced
1. What’s New in React
2. Advanced Components
3. Enhanced Components
4. React Patterns
5. React Accessibility
- 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.