Just and example of ant-design working in React 16:
Make sure you have the latest Stable or LTS version of Node.js installed.
git clone https://github.com/espinacs/ant-design-boilerplate
- Run
npm install
oryarn install
- Start the dev server using
npm start
- Open http://localhost:8080
npm start
- start the dev servernpm clean
- delete the dist foldernpm run production
- create a production ready build indist
foldernpm run lint
- execute an eslint checknpm test
- run all testsnpm run test:watch
- run all tests in watch modenpm run coverage
- generate code coverage report in thecoverage
folder
Also, precommit and prepush are both enabled to check all the code is linted and tested.
Although this application is really simple (just fetch data, list and filter it) it has a pretty complete architecture, as detailed:
React is just the way to display the stored info. Mainly, there's a Main container that dispatches both fetch and filtering events, and at the same times renders the SearchBar (self component) and the Ant Desing Table
Redux-Saga is the agent dedicated to fetch data from the server, and dispatches the convenient Redux events with fetched data or errors.
This is only a layer that could be changed, for example, by an Apollo GraphQL interface.
Redux stores part of the state of the application (a part from the one that each component/containers handles for itself).
Components are not subscribed directly to the Redux state. Instead, they only get data from the Redux state through Reselect selectors.
This way, components/containers and redux are absolutely decoupled, and any other State Manager (Flux, for example) could be used, like any other components library (Vue.js, for example)
Ant Design Gives to the project a small style boost!
The project is using the Jest Code Coverage tool. The reports are generated by running npm run coverage
. All configurations are located in package.json
, inside the jest
object.
The coverage report consists of an HTML reporter, which can be viewed in the browser and some helper coverage files like the coverage json and xml file.
Run npm run production
. The production-ready code will be located under dist
folder.
ant-design-boilerplate is available under MIT.