React + Redux starter kit / boilerplate with Babel, hot reloading, testing, linting and a working example app built in
A comprehensive starter kit for rapid application development using React.
npm startto start development in your default browser.
npm run buildto do all this:
Initial Machine Setup
First time running the starter kit? Then complete the Initial Machine Setup.
Click "Use this template"
Click the green "Use this template" button at the top of this page and enter a name and description for your repo.
Run the setup script
npm run setup
Run the example 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 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.
Review the example app.
This starter kit includes a working example app that calculates fuel savings. Note how all source code is placed under /src. Tests are placed alongside the file under test. The final built app is placed under /dist. These are the files you run in production.
Delete the example app files.
Once you're comfortable with how the example app works, you can delete those files and begin creating your own app.
Having issues? See Having Issues?.
Install Node 8.0.0 or greater
Need to run multiple versions of Node? Use nvm.
Disable safe write in your editor to assure hot reloading works properly.
Complete the steps below for your operating system:
* Install [watchman](https://facebook.github.io/watchman/) via `brew install watchman` or fswatch via `brew install fswatch` to avoid [this issue](https://github.com/facebook/create-react-app/issues/871) which occurs if your macOS has no appropriate file watching service installed.
echo fs.inotify.max_user_watches=524288 | sudo tee -a /etc/sysctl.conf && sudo sysctl -p.
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.
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).
npm install- If you forget to do this, you'll see this:
babel-node: command not found.
Install watchman with
brew install watchmanif you are having the following error after an initial
npm start -s:
2017-09-05 00:44 node (FSEvents.framework) FSEventStreamStart: register_with_server: ERROR: f2d_register_rpc() => (null) (-22) 2017-09-05 00:44 node (FSEvents.framework) FSEventStreamStart: register_with_server: ERROR: f2d_register_rpc() => (null) (-22) events.js:160 throw er; // Unhandled 'error' event ^
Error: Error watching file for changes: EMFILE at exports._errnoException (util.js:1022:11) at FSEvent.FSWatcher._handle.onchange (fs.js:1406:11)
Tip: Things to check if you get an
npm run linterror or build error:
* If ESW found an error or warning in your project (e.g. console statement or a missing semi-colon), the lint thread will exit with `Exit status 1`. To fix:
npm run lintscript to
"esw webpack.config.* src tools; exit 0"
npm run lint:watchscript to
"esw webpack.config.* src tools --watch; exit 0"
> Note: Adding
exit 0will allow the npm scripts to ignore the status 1 and allow ESW to print all warnings and errors.
eswglobally installed version matches the version used in the project. This will ensure the
eswkeyword is resolved.
npm rebuild node-sassif you are having and error like
Node Sass does not yet support your current environment on macOS XXXafter an initial
npm start -s.
Slingshot offers a rich development experience using the following technologies:
| 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.| Getting Started with Redux, Building React Applications with Idiomatic Redux, Pluralsight Course|
| React Router | A complete routing library for React | 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|
| Jest | Automated tests with built-in expect assertions and Enzyme for DOM testing without a browser using Node. | Pluralsight Course |
| ESLint| Lint JS. Reports syntax and style issues. Using eslint-plugin-react for additional React specific linting rules. | | | SASS | Compiled CSS styles with variables, functions, and more. | Pluralsight Course| | PostCSS | Transform styles with JS plugins. Used to autoprefix CSS | | 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? |
The starter kit includes a working example app that puts all of the above to use.
Check out the FAQ