Join Carl Peaslee for an in-depth discussion in this video Using extends and super, part of React: ES6, ES2016, and Beyond.
- [Instructor] In our last video,…we instantiated a class and brought it into our App.…And now in this video,…we're going to work with the functionality…called extends and super.…You may be familiar with the extends syntax…here inside of our component.…So when we call a component from React,…we're actually extending the React component class.…Now let's navigate to our utils file.…We're going to extend our Random class…and we're going to make a random color class.…Here on line 22, we're going…to declare our class ColorGenerator,…and we're going to say that it extends Random.…
We're once again going to use the constructor…and we're going to use a constructor here…in our ColorGenerator class…just like we did in class Random.…And we're going to pass along the same values.…So in our Random class here on line 4,…we said max and allowNegatives,…so we're going to include those two.…We're also going to add another argument to our constructor.…So we're going to say, when someone makes…a ColorGenerator class, they're going to have…
- Using const and let
- Importing and exporting modules
- Arrow functions
- Destructing assignments
- Arguments and template literals
- Extended parameter handling with the spread operator
- Generating custom styles
- Classes, getters and setters
Skill Level Intermediate
1. Variables and Declarations
2. Arguments and Template Literals
4. Promises and Async
- 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.