React 16 + React-Router 4 + Redux + Bootstrap + Webpack 3 with Hot Reload and redux-devtools-extension STARTER
My best React + redux project starter.
- webpack is as simple as possible
- ReactJS is written with
optimization tricks
(stateless, pure render, PureComponent...). pure front-end
= server independant (use whatever you want as server: NodeJS, Rails, .NET...)
Concept behind: same as react-bootstrap-webpack-starter but added Redux
and amazing and helpful redux-devtools-extension.
- upgrade to React 16.x
react-router 4+
withreact-router-redux ^5.0.0-alpha.8
(read this nice article about migrating from react-router 3 to react-router 4)- add few flow types (still keep propTypes)
- updated hot reload (read hot reload starter)
- use
CSS module
(keep coding style with SASS but get benefit of css module for a more peasant and component pattern coding)
- upgrade
React 15.6.x +
- upgrade to
webpack 3
- clean with rimraf before bundles building
- scroll to top on route
- login view
- protected view
- JWT auth. private views
- file organization (views connected to redux are no more in container but are index.js in same directory as View.js)
- upgrade to
react-router v4
- upgrade to
webpack 2.x
- upgrade
React 15.5.x +
PropTypes
from 'prop-types' (react 15.5 breaking change)
cross-env
added so no more particular windows command- serve dev and prod bundles
npm run serve-dev
: with server hot reload (uses nodemon)npm run serve-prod
: production like node-express server
whatwg-fetch
is now replaced by axios.react-addons-shallow-compare
is removed since ReactJS 15.4+ PureComponent does the job- splits vendors script and css from main bundle (extract-text-webpack-plugin v1.x)
- create map file (DEV)
- prepared
launch.json
for VSCode debugger - add typescript types (typings)
- add flow types (flow-typed)
- redux-devtools is now replaced by redux-devtools-extension.
Front:
- React JS (16.x+ - github π)
- Redux (as you application grows managing state will be a serious concern, save pain with Redux)
- React-Redux (Redux is not specific to ReactJS, you could easily use it with Angular2 for instance)
- redux-devtools-extension (github π)
- React-Router-Redux 5.x (github π)
- react-router (4.x- github π)
- Bootstrap (3.x - github π)
- React-Bootstrap (github π)
- font-awesome (github π)
- animate.css (github π)
- classnames (github π)
- react-motion (github π)
- Webpack 3.x (github π)
- babel 6+ (github π)
- axios (github π Why: simple, complete, isomorphic ...)
Tool chain:
- babel 6+
- eslint
- webpack 2
- hot reload
- loaders
js
/jsx
- sass
- css
- json
- images formats
- svg and fonts formats
tests:
- Mocha
- Chai (+ dirty-chai)
- enzyme
- Sinon
- nyc
npm install
npm run dev
npm run start
npm run test
npm run prod
with server hot reload:
npm run serve-dev
without hot reload:
npm run serve-prod
The MIT License (MIT)
Copyright (c) 2017 Erwan DATIN
Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:
The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.