Join Alex Banks for an in-depth discussion in this video Saving audience state, part of Building a Polling App with Socket IO and React.js.
- As new members join our presentation,…we're going to need to save them to an array.…We are going to use an audience variable…to manage all of our audience members.…So that is going to be one of our state variables…that will start here on the server.…I am looking at the app-server.js file,…and I'm coming into line 5 here.…I'm going to drop my cursor right at the end of line 5…and hit enter, and I will create a variable for audience.…So this audience variable is going to be an array,…and as members join, we want to add them to this array.…So when a member joins, it is being handled down here,…inside this event handler for the join event.…
So on line 22, this callback function…handles new audience member joins.…Now, we're emitting a join event to the socket…that recently joined, but we also need…to save the audience member to that array.…So I could just use audience.push…to push the newMember into that array.…So now when members join, we're going to…go ahead and add them to the array.…But now what we need to do is, we need to update…
Author
Released
9/9/2015- 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
Duration
Views
Related Courses
-
Building a Responsive Single-Page Design with Sass
with Ray Villalobos4h 55m Intermediate
-
Introduction
-
Welcome47s
-
Using the exercise files2m 27s
-
-
1. Setting Up the Environment
-
Setting up npm scripts4m 22s
-
2. Connecting Sockets
-
Incorporating Socket IO5m 46s
-
Displaying connection status5m 55s
-
Handling disconnects6m 5s
-
-
3. App State and Routes
-
Adding a default title3m 32s
-
Setting up the React router12m 19s
-
4. Joining the Presentation
-
Creating a display component6m 59s
-
Creating the join form5m 55s
-
Emitting a join event6m 23s
-
Saving audience state5m 49s
-
-
5. Starting the Presentation
-
Build speaker form13m 54s
-
Broadcasting speaker data6m 29s
-
Display attendance7m 54s
-
-
6. Questions and Answers
-
Asking a question8m 37s
-
Setting up multiple choices12m 37s
-
Answering a question11m 36s
-
7. Graphing Results on a Scoreboard
-
Connecting the board7m 32s
-
Graphing the results8m 49s
-
-
8. Upgrading to ES6 Syntax
-
Using ES6 imports3m 4s
-
Using ES6 class syntax1m 18s
-
React ES6 properties2m 8s
-
ES6 arrow functions8m 17s
-
React ES6 class state4m 16s
-
-
Conclusion
-
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.
CancelTake 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.
Share this video
Embed this video
Video: Saving audience state