a boilerplate for react server-side rendering app
- React + Redux + React-Router
- Sever side render with Koa
- Webpack 4+
- support sass
- support cssmodules with babel-plugin-react-css-modules
- Build with dll plugin
// run client and server side for dev
npm start
// build client and server side
npm run build
// start serve
npm run serve
Write fetch hooks in containers
It will auto fetch and update the states both on the client and server side
@provideHooks({
fetch: ({ dispatch, params }) => dispatch(getUserList())
})
@connect(state => state.users)
export default class UserContainer extends Component {
render() {
const { userList } = this.props
return (
<UserComp userList={userList}/>
)
}
}