blog icon indicating copy to clipboard operation
blog copied to clipboard

Static Site Generation with React and Webpack

Open TerrellV opened this issue 9 years ago • 5 comments

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

TerrellV avatar Dec 17 '15 06:12 TerrellV

Problems I've run into so far:

  • DefaultRoute is now IndexRoute.
  • 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.run no 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.

jaredmcateer avatar Dec 21 '15 19:12 jaredmcateer

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 avatar Dec 22 '15 10:12 pascalgermain

@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

travellingprog avatar Jan 07 '16 17:01 travellingprog

I can't figure out how to render it with react-router 1.0.0, any ideas?

alekspetrov avatar Jan 19 '16 15:01 alekspetrov

Has anybody managed to upgrade React Router to 1.x.x?

cutemachine avatar Jan 29 '16 08:01 cutemachine