rlr <Fragment forNoMatch>
const React = require("react");
const ReactDOM = require("react-dom/server");
const { Provider } = require("react-redux");
const { createStore, applyMiddleware, compose, combineReducers } = require("redux");
const { routerForExpress, initializeCurrentLocation, Fragment } = require("redux-little-router");
const router = routerForExpress({
routes: { '/': { title: 'Home' } },
request: { path: '/' }
});
const store = createStore(
combineReducers({ router: router.reducer }),
{},
compose(router.enhancer, applyMiddleware(router.middleware))
);
const initialLocation = store.getState().router;
store.dispatch(initializeCurrentLocation(initialLocation));
ReactDOM.renderToString(
<Provider store={store}>
<div>
<Fragment forRoute="/">
<div>
<Fragment forRoute="/">
<h1>Home</h1>
</Fragment>
<Fragment forNoMatch>
<h1>404</h1>
</Fragment>
</div>
</Fragment>
</div>
</Provider>
);
no comments