Join Alex Banks for an in-depth discussion in this video Answering a question, part of Building a Polling App with Socket IO and React.js.
- When an audience member answers one of the questions…by clicking on a choice button…we need to collect that information on the server.…So I'm going to start here in app-server…and the first thing I'm going to do is add…yet another variable to our state.…So down here on line 11…I'm going to create a variable for results.…These results are going to represent the questions…that the audience has answered.…Now all of these questions are multiple choice…so we have a, b,…c, and d as the available options.…
If we have ten people connected to our socket…when we first ask a question,…no one has answered a, no one has answered b,…c, or d, so we're going to start off at 0.…As our audience members answer each question…we will then increment the results.…So if two people have answered b,…we will set that value to 2.…So let's start off with 0.…Add that socket listener that will listen for when…a question is answered and increment these results.…So I'm going to scroll down here below line 24…where we are wiring up all the socket listeners,…
- 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?
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.