This demo is supposed to give you a quick overview in the way modern frontend development can be done. This example is bit simplified and does not use some more advanced concepts with React such as Redux/Flow -patterns. We will not be bundling the frontend with the backend either.
There are different branches for each step.
Frontend code for this lab is written in EcmaScript 2015 (JavaScript ES6) and it uses webpack to bundle things.
- Install Chrome or Firefox
- Install React Developer Tools
Things will be demoed on Google Chrome, but Mozilla Firefox or Microsoft Edge should be fine too. Edge does not yet have the React Developer Tools.
- Install lightweight texteditor, such as Atom
- Install React (.jsx) support for Atom https://atom.io/packages/react
Important things first, to get things running you will have to have node installed, preferrably version 6 (current version, not LTS).
-
Verify that was installed by running the following command
node --version
returns the node version numberv6.2.0
. -
After node has been installed, we have to install our dependencies with
npm
, node package manager, with the commandnpm install
. -
Lastly we run the actual application with the command
npm start
which starts local node server that hosts our frontend application.
For component testing we are using AVA test runn er in conjuction with Enzyme to test React components.
Tests can be run with npm run test
, tests can be found under the ./test/
-folder. AVA searches this folder automatically.
http://jeffcarp.github.io/frontend-hyperpolyglot/
- Elm
- React + Redux (time-travel)
- React Native
- Cycle.js
Good resources to continue learning about React and frontend development in general: https://reactforbeginners.com/ (beginner friendly) https://learnredux.com/ (advanced) https://www.codeschool.com/learn https://github.com/getify/You-Dont-Know-JS https://frontendmasters.com/
High level overview what each step contains
ForumContainer component main, boostrapping application to dom
SingleTopic component ForumContainer, mapping items to components
moment.js timehandling library Message component SingleTopic, map messages to Message component
axios http-promise library, communication with backend using GET ForumContainer SingleTopic
SendText re-usable component
Communication with backend using axios by using POST ForumContainer SingleTopic
Same as master