A web's scaffolding tool for react ssr webapps.using React, Redux, Rematch(A redux framework) and Scss.
This project can help you start the react ssr project in seconds. You can thing of it as a nodejs application. It integrated HMR, Proxy, Test, Lint, Server Logger
git clone https://github.com/zedwang/react-ssr-startkit.git
cd react-ssr-startkit
npm install
npm start
Then visit localhost:8080
in your browser.
npm build
Will genarate a dist
directory
dist
bin
server.boundle.js # app entry
public
... #some js css images etc
The server side fetching data
client:
class Home extends React.Component {
// some logic
}
// modelType/action
// see: https://rematch.gitbooks.io/rematch/docs/api.html#storedispatch
Home.serverFetch = {type: 'repos/fetchData'};
server:
routes
.filter(route => matchPath(req.url, route))
.map(route => route.component)
.filter(comp => comp.serverFetch)
.map(comp => {
const {type, payload} = comp.serverFetch;
return dispatch({type, payload});
});