Skip to content

🔥🔥🔥A web's scaffolding tool for react ssr.Using React, Rematch

License

Notifications You must be signed in to change notification settings

zedwang/react-ssr-startkit

Repository files navigation

react-ssr-startkit

A web's scaffolding tool for react ssr webapps.using React, Redux, Rematch(A redux framework) and Scss.

Goal

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

Usage

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.

Deploy

npm build

Will genarate a dist directory

dist
  bin
    server.boundle.js # app entry
  public
    ... #some js css images etc

Tips

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});
    });

About

🔥🔥🔥A web's scaffolding tool for react ssr.Using React, Rematch

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages