Join Alex Banks for an in-depth discussion in this video Displaying connection status, part of Building a Polling App with Socket IO and React.js.
- Alright, now let's indicate the socket's connection status…with a visual component instead of an alert.…What we're going to do is we are going to…go ahead and open up our header component,…so under components, under parts,…there's the Header.js file, and inside of this component,…we are going to add a status property.…We are going to add a span that indicates the status.…Now you already have styles set up for this span.…All we need to do is set its class name…to connected or disconnected.…So right here, this thing that we need to do…is we are going to add a default property for status.…
What that means is if we don't send status…to this component, we will have…a default property in its place.…So we can do this with getDefaultProps.…So this is a react method that we can use…to return default properties.…So we're going to return property of status,…and set it to disconnected.…So the idea here is our title is required,…but our status property is optional.…However, if you don't send the status property,…we will still have a variable that you can use.…
- 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
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?
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.