Skip to content

Latest commit

 

History

History
93 lines (66 loc) · 3.1 KB

README.md

File metadata and controls

93 lines (66 loc) · 3.1 KB

react-redux-boilerplate

  • It is React-Redux as infrastructure boilerplate, with this developers just focus on developing component, action creator and reducer, without spending time in router, dev/pro build enviroement, wiring up file and express as HTTP server.

Read more

Install

$ git clone https://github.com/wahengchang/react-redux-boilerplate
$ npm install

Run (Develop Mode)

It is runnign in Development mode, enable HMR

$ npm run dev
open http://localhost:3000/

Run (Production Mode)

  • Compiling react/redux script to browser use lib, with webpack default optimized config.
  • Disable unnecessary funtionality which helps to debug in development mode
$ npm run build
$ node dist/server.js 

lint

lint fix

$ npm run lint:fix

lint check

$ npm run lint

Storybook

$ npm run storybook

Test

More detail: about test of action creater, component, container and reducer

$ npm run test


Test Suites: 4 passed, 4 total
Tests:       6 passed, 6 total
Snapshots:   0 total
Time:        1.824s, estimated 2s

or watch mode

$ npm run test:watch

Server Rendering Structure

Server Rendering structure Above is the structure of how the whole app works, the app bases on Express web framework, which serves only one route, with res.sendFile function to put index.html into the browser. Inside the scoop of the structure, what we are interested is the blue box, the interaction between react component, redux, root component, store and reducer.

Shared Components

react-redux-universial-container-compont

React-Redux Structure

react-helloworld-component-5-20 index.js , as the entry file and a high level root component, which gathers all the sub-component as the subtree of the Virtual DOM, also it is the only file entangled with many independent modules. Apart from it, different file requires independent modules, which makes clean code and work independently.

Credit