blog
blog copied to clipboard
Static Site Generation with React and Webpack
It would be really great to see this updated to work with React Router 1.0.0.
I have been trying to go through the exact same setup as you mentioned in your guide but havent been able to figure it out with react router 1.0.0.
Just a suggestion.
Thanks
Problems I've run into so far:
DefaultRouteis nowIndexRoute.- Route, IndexRoute object now on root level as Router
var Router = require('react-router').Router;var Route = require('react-router').Route;var IndexRoute = require('react-router').IndexRoute;- or
import {Router, Route, IndexRoute} from 'react-router';if you're using es6
Router.runno longer exists.- This is where I'm stuck, my level of knowledge with React is limited so I'm not sure how to port this part yet.
Yeah, that's sad to be stuck with those great tutorials because everything moves so quickly. My way to handle this was to install older versions of the modules (modules versions should probably be mentioned in the "npm install" of those tutos), found on https://github.com/jxnblk/writing/blob/gh-pages/package.json:
"devDependencies": {
"jsx-loader": "^0.13.2",
"react": "^0.13.3",
"react-router": "^0.13.3",
"static-site-generator-webpack-plugin": "^1.0.0",
"webpack": "^1.9.7",
"webpack-dev-server": "^1.8.2"
}
@pascalgermain thanks for the tip!
@jaredmcateer I found the official upgrade guide for React Router 1.0.0 at https://github.com/rackt/react-router/blob/master/upgrade-guides/v1.0.0.md. Seems like Router.run was replaced by a render function from the module react-dom. This looks like a good reference example: https://github.com/rackt/react-router#whats-it-look-like
I can't figure out how to render it with react-router 1.0.0, any ideas?
Has anybody managed to upgrade React Router to 1.x.x?