Join Carl Peaslee for an in-depth discussion in this video Getter, setter and, static, part of React: ES6, ES2016, and Beyond.
- [Instructor] In the last video,…we extended our random class to make a ColorGenerator,…and in this video we're going to make use…of the getter and setter methods on a class.…Let's navigate to our utils file…and we're going to go into our ColorGenerator…and we're going to create a getter and setter on…our ColorGenerator that I imagine is going…to be sort of a utility function that's going…to help us out, and it's going to return the types…that are available.…So in the last video,…we made this property types on our ColorGenerator,…but I want to make this available to a developer,…even if they haven't instantiated the class.…
And that's one of the ways that getInset is useful.…So I'm going to refactor this a little bit.…I'm going to say, actually types, let's make this typeList…and here up on line 25 I'm going…to change types to typeList.…A side note that maybe I didn't emphasize in the last class,…but .includes is a new ES2016 method…that is available on Array,…and it iterates over the Array looking for something.…
- 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.