Introduction and Getting Started with React.js - JSConf 2015 Training Workshop
React.js is a game changer. Learn what makes it special and get started today.
HD Video
Watch HD video on YouTube (Use HD setting for best clarity)
Slides
Meta Information
- Author: Jeff Barczewski
- Published: May 29th, 2015
- Tags: reactjs, javascript,nodejs
- Updated: July 8th, 2015
Workshop starter code
git clone or download and extract zip for one of the following repos. We will use this to get jump started into the project
- https://github.com/codewinds/jsconf-react
- https://github.com/codewinds/jsconf-react-win (Windows developers)
REST API for workshop
Details of the REST API that we will be calling from our React.js app.
Get all polls
Server returns just the questions and choices, no voting results.
- GET /polls
{
"polls" : [
{
"id" : "p1",
"question" : What is 1 + 1?",
"choices" : [
"one",
"two"
]
},
{
"id" : "p2",
"question" : "What is 2 + 2?",
"choices":[
"three",
"four"
]
}
]
}
Vote on a poll / Receive results
Once a user posts their vote, the response from the server contains the updated poll results (total number of votes for each choice, null for no votes).
- POST /polls/ID - ID is the poll id voting on
Payload to post is poll ID for the key and value is zero based index of the choice selected (string will be coerced to integer)
{ "p1": "0" }
Response from server after updating the votes is total number of votes for each choice (null represents no votes).
{ "votes" : [1, 6] }
Represents 1 vote for choice at index 0, and 6 votes for choice at index 1.
Add a poll
- POST /polls
Payload to post
ID will be assigned by server and returned in the response
{
"question": "What?",
choices: [
"Foo",
"Bar"
]
}
Response from server
{
"added": {
"id" : "NJMZ1TeS"
}
}
Admin polls and results
Contains all poll questions, choices, and resulting vote totals.
- GET /admin/polls
{
"polls" : [
{
"id" : "p1",
"question" : "What is 1 + 1?",
"choices": ["one","two"],
"votes":[2, 6]
},
{
"id" : "p2",
"question" : "What is 2 + 2?",
"choices" : ["three","four"],
"votes":[null, 8]
}
]
}
Working example app
- http://survey.codewinds.com/
- http://survey.codewinds.com/admin.html (admin interface)
Notes
- base-react-min - My minimal React.js boilerplate with an auto build environment. Just clone or download, npm install, npm run watch
- base-react-min-win - My minimal React.js boilerplate with an auto build environment. Just clone or download, npm install, npm run watch (Windows version)
- git-clone-init - npm install this bash script to make it easy to git clone, rm .git, git init, replace project name tokens, and do initial check in. Very useful for creating a new project off a boilerplate repo
- Facebook’s React.js Home - great getting started guide and tutorials for starting to learn React.js
- Facebook’s React Native Home - build native iOS and Android apps with React and Javascript.
- Facebook’s Flux Home - application architecture that Facebook used for building client-side web applications.
- Takeaways from React.js Conf 2015 - Kevin Old’s thoughts on React.js Conf 2015
- Joe Armstrong - The Mess we’re in - Strange Loop Conf 2014 - Joe, the inventor of Erlang, discusses the situation we are in with regards to technology. He provides some reasons and suggestions for improving the status quo.
- Immutable.js - Fantasic package of immutable collections for JavaScript which are implemnted with Peristent Data Structures. Immutable data works great with React.js and is highly recommended.
- axios - isomorphic HTTP client for browser and node.js which uses promises
- nets - isomorphic HTTP client for browser and node.js. Uses
request
on Node.js andxhr
in browsers, but with a common interface. - React Native Playground - test and share JavaScript for React Native apps in the comfort of your browser. Uses appetize.io to run iOS simulator
- Relay / GraphQL
- GraphQL Introduction
- react-resolver - isomorphic library to recursively lazy-load data for React.js components
- react-transmit - Relay-inspired library based on Promises instead of GraphQL
- FalcorJS - NetFlix project. One model everywhere. Async MVC. Like binding to your data in the cloud. JSONGraph - sophisticated client / server fetches and caches data in asynchronous manner.
- Hammerlab Tutorial on testing React.js project with Mocha
- Hammerlab Tutorial on setting up code coverage for React.js project
Examples
- react-native-rss-reader - working rss reader for iOS which uses React Native, Flux, and Google Feeds API
- React Native weather app - working React Native app which fetches weather for your location
Resources
- Components
- http://react.parts - Catalog of React.js for web and React Native components and apps
- http://npmsearch.com use “react and YOUR_KEYWORD” - since most React.js components are in npm, you can use this to find components.
- Google (site:github.com react xyz)
- http://reactjs.com/ - main site for React.js updates
- http://reactnative.com/ - Collection of information about React Native.
Related CodeWinds Content
- CodeWinds podcast episode 4 - Pete Hunt discusses React.js
- CodeWinds podcast episode 15 - Michael Jackson and Ryan Florence explain that React.js really changes how we think about and build web and mobile apps
- The React.js Conference experience - ReactJS Conference was one of my all time favorite conferences with the perfect blend of technology, community, and fun
To learn more / CodeWinds React.js Video Training
CW React.js Fundamentals - The premier online course and community where you learn React.js by pragmatically building a real web app while applying TDD/BDD principles
“Highly recommended!”- Kevin Old, Senior Software Engineer
“Look no further, the React.js Fundamentals course is the only course you will need to become an expert in React.js”- Wyatt Preul, Software Architect, nearForm
“Overall I would give this React.js course a 4-star thumbs up!”- Kevin Bridges - Senior Technical Consultant at Applied Software
Subscribe to the CodeWinds Leading Edge member list to stay up to date on the latest in React.js and get exclusive offers on CodeWinds React.js video training courses.