This is the project I use to start react projects
- Initial Machine Setup.
- Clone the project.
git clone https://github.com/DavidWells/react-project-base.git
. - Install Node packages.
npm install
- Run the app.
npm start -s
This will run the automated build process, start up a webserver, and open the application in your default browser. When doing development with this kit, this command will continue watching files all your files. Every time you hit save the code is rebuilt, linting runs, and tests run automatically. Note: The -s flag is optional. It enables silent mode which suppresses unnecessary messages during the build.
Tech | Description | Learn More |
---|---|---|
React | Fast, composable client-side components. | Pluralsight Course |
Redux | Enforces unidirectional data flows and immutable, hot reloadable store. Supports time-travel debugging. Lean alternative to Facebook's Flux. | Tutorial |
React Router | A complete routing library for React | Pluralsight Course |
Babel | Compiles ES6 to ES5. Enjoy the new version of JavaScript today. | ES6 REPL, ES6 vs ES5, ES6 Katas, Pluralsight course |
Webpack | Bundles npm packages and our JS into a single file. Includes hot reloading via react-transform-hmr. | Quick Webpack How-to Pluralsight Course |
Browsersync | Lightweight development HTTP server that supports synchronized testing and debugging on multiple devices. | Intro vid |
AVA | Automated tests with Ava for assertions and JSDOM for DOM testing without a browser using Node. | |
TrackJS | JavaScript error tracking. | Free trial |
ESLint with JS Standard | Lint JS. Reports syntax and style issues. | JS Standard Docs |
PostCSS | PostCSS is a tool for transforming styles with JS plugins. These plugins can lint your CSS, support variables and mixins, transpile future CSS syntax, inline images, and more. In addition we are using CSS modules for localized ClassNames | PostCSS Docs + CSS modules |
Editor Config | Enforce consistent editor settings (spaces vs tabs, etc). | IDE Plugins |
npm Scripts | Glues all this together in a handy automated build. | Pluralsight course, Why not Gulp? |
##Initial Machine Setup
- Install Node 4.0.0 or greater - (5.0 or greater is recommended for optimal build performance). Need to run multiple versions of Node? Use nvm.
- Install Git.
- Install React developer tools and Redux Dev Tools in Chrome. (Optional, but helpful. The latter offers time-travel debugging.)
- On a Mac? You're all set. If you're on Linux or Windows, complete the steps for your OS below.
On Linux:
- Run this to increase the limit on the number of files Linux will watch. Here's why.
echo fs.inotify.max_user_watches=524288 | sudo tee -a /etc/sysctl.conf && sudo sysctl -p
On Windows:
- Install Python 2.7. Some node modules may rely on node-gyp, which requires Python on Windows.
- Install C++ Compiler. Browser-sync requires a C++ compiler on Windows. Visual Studio Express comes bundled with a free C++ compiler. Or, if you already have Visual Studio installed: Open Visual Studio and go to File -> New -> Project -> Visual C++ -> Install Visual C++ Tools for Windows Desktop. The C++ compiler is used to compile browser-sync (and perhaps other Node modules).
Huge shoutout to Cory House for react-slingshot which is the base of this.
Seeing browser-sync and hot module reloading made my brain explode.
This project is slightly different with using PostCSS and CSS modules for styles and AVA for testing. Also using a slightly modified version of JS standard (see babelrc for that)