Join Alex Banks for an in-depth discussion in this video React ES6 class state, part of Building a Polling App with Socket IO and React.js.
- Since we are upgrading from declaring…our components with React.createClass…to class extend the React component,…we lose the capabilities to invoke getInitialState.…So very similar to how we have…to handle properties different,…we also need to handle state a little differently…with ES6 components.…So I'm going to update our APP component…to use that class syntax.…So on Line 7, I'm going to declare…that class APP extends React.Component…and get rid of that parenthese…as well as scrolling all the way down to the bottom…and getting rid of the semicolon…and parenthese found on Line 95.…
Now we have to do a couple of different things.…We do not have a getInitialState function…that will automatically invoke for us…so instead of getInitialState,…I'm going to change this to the constructor.…So the constructor will invoke…when we create an instance of the APP,…and since the APP inherits from React.Component,…the very first thing we need to do…in our constructor is invoke the super.…Invoking super will invoke…the React.Component's constructor…
- Setting up the environment
- Connecting sockets
- Handling disconnects
- Setting up the React.js router
- Passing state to child components as properties
- Joining the presentation
- Starting and running the presentation
- Asking and answering questions
- Graphing results
- Upgrading to ES6
Skill Level Intermediate
Building a Responsive Single-Page Design with Sasswith Ray Villalobos4h 55m Intermediate
1. Setting Up the Environment
Setting up npm scripts4m 22s
2. Connecting Sockets
3. App State and Routes
4. Joining the Presentation
5. Starting the Presentation
6. Questions and Answers
7. Graphing Results on a Scoreboard
8. Upgrading to ES6 Syntax
Next steps1m 1s
- 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.