vortex-react
Get start with React/Redux/React-Router-Dom/Webpack3/Reactstrap
2017/8/29 checkout branch mobx to see the version mobx instead of redux!
Table of Contents
Feature
- React
- ES6/7/8 + Babel
- Webpack3
- Redux
- React-Router-Dom
- Reactstrap + Bootstrap^4.0.0-alpha.6 (UI)
- Sass
- Eslint
- Express
Get Start
Before the start, we recommend you read these documentation.
You can tru ES6 and JSX in Babel REPL.
We recommend node 6.x + npm 5.x + yarn ^0.27.5γ
Install
git clone https://github.com/yuthelloworld/vortex-react.git <my-project-name>
cd <my-project-name>
yarn # Install project dependencies (or `cnpm install`)
Run
yarn start # Start the development server (or `npm start`)
Scripts
yarn <script> |
Description |
---|---|
start |
Serves your app at http://localhost:3000 |
build |
Builds the application to ./dist |
lint |
Lints the project for potential errors |
lint:fix |
Lints the project and fixes all correctable errors |
Project Structure
File Tree
.
βββ build # All build-related code
βββ public # Static public assets (not imported anywhere in source code)
βββ server # Express application that provides webpack middleware
β βββ main.js # Server application entry point
βββ src # Application source code
β βββ index.html # Main HTML page container for app
β βββ main.js # Application rendering
β βββ normalize.js # Browser normalization and polyfills
β βββ components # Global Reusable Components
β βββ layouts # Components that dictate major page structure
β β βββ PageLayout # Components that dictate major page structure
β βββ routes # Components that dictate major page structure
β β βββ index.js # Main application routes with store
β β βββ Home # Fractal route
β β β βββ index.js # Route definitions and async split points
β β β βββ assets # Assets required to render components
β β β βββ components # Presentational React Components
β β β βββ routes **
β β βββ Counter
β β βββ index.js
β β βββ container # Container component
β β βββ modules # redux module(reducers/constants/actions)
β β βββ routes **
β βββ store # Redux store
β β βββ createStore.js # Create store
β β βββ reducers.js # Reducers
β βββ styles # Style sheet
βββ tests # Unit tests
Data Flow
Logic
Live Development
We use webpack-dev-middleware
abdwebpack-hot-middleware
for server and HMR γ
We recommend using Redux DevTools Chrome Extension.
Deploy
Use
nginx
to proxy static web to start this appγPoint at~/dist/index.html
.See moreγ
This is an exmaple in ubuntu:
- Install nginxοΌ
sudo apt-get install nginx
- ConfigοΌ
sudo vi /etc/nginx/sites-available/default
- Copy the flowing to configοΌ
server{
listen 8001;
server_name 127.0.0.1; //server Ip
location / {
proxy_pass http://127.0.0.1:3000;
}
}
- restart nginxοΌstart appοΌbrowser http://localhost:8081γ
sudo service nginx restart
// `cd your app`
yarn start
Code Style
Refrence airbnb/javascriptγJavascript Standard Style and standard-reactοΌwe set up .eslintrc
More
Welcome PRs and issues!