Skip to content
This repository has been archived by the owner on Jan 11, 2019. It is now read-only.

Commit

Permalink
Upgrade to React Router 2.0.
Browse files Browse the repository at this point in the history
  • Loading branch information
Rick committed Feb 18, 2016
1 parent 02c19a6 commit 131bc92
Show file tree
Hide file tree
Showing 6 changed files with 26 additions and 29 deletions.
4 changes: 2 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -18,8 +18,8 @@ Isomorphic starterkit with server-side React rendering using
## Features

- Fully automated toolchain with npm run scripts
- React 0.14 + React Router 1.0 on the client and server
- Babel 6 automatically compiles ES2015 + ES7 draft
- React 0.14 + React Router 2.0 on the client and server
- Babel 6 automatically compiles ES2015 + ES7 stage-0
- Webpack HMR for instant server updates
- React Transform HMR for instant client updates
- React Transmit to preload on server and hydrate client
Expand Down
37 changes: 18 additions & 19 deletions package.json
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
{
"name": "react-isomorphic-starterkit",
"description": "Isomorphic starterkit with server-side React rendering.",
"version": "5.1.3",
"version": "5.2.0",
"license": "BSD-3-Clause",
"repository": {
"type": "git",
Expand Down Expand Up @@ -31,34 +31,33 @@
"watch": "node node_modules/concurrently/src/main --kill-others \"npm run watch-server-start\" \"npm run watch-server\" \"npm run watch-client\""
},
"dependencies": {
"babel-polyfill": "6.3.14",
"babel-polyfill": "6.5.0",
"fetch-plus": "3.6.1",
"fetch-plus-bearerauth": "3.5.0",
"fetch-plus-json": "3.6.0",
"history": "1.17.0",
"isomorphic-fetch": "2.2.0",
"isomorphic-fetch": "2.2.1",
"koa": "1.1.2",
"koa-proxy": "0.4.1",
"koa-static": "2.0.0",
"react": "0.14.6",
"react-dom": "0.14.6",
"react-inline-css": "2.0.1",
"react-router": "1.0.3",
"react-transmit": "3.1.6"
"react": "0.14.7",
"react-dom": "0.14.7",
"react-inline-css": "2.1.0",
"react-router": "2.0.0",
"react-transmit": "3.1.7"
},
"devDependencies": {
"babel": "6.3.26",
"babel-core": "6.4.0",
"babel-loader": "6.2.1",
"babel-preset-es2015": "6.3.13",
"babel-preset-react": "6.3.13",
"babel-preset-react-hmre": "1.0.1",
"babel-preset-stage-0": "6.3.13",
"concurrently": "1.0.0",
"babel": "6.5.2",
"babel-core": "6.5.2",
"babel-loader": "6.2.3",
"babel-preset-es2015": "6.5.0",
"babel-preset-react": "6.5.0",
"babel-preset-react-hmre": "1.1.0",
"babel-preset-stage-0": "6.5.0",
"concurrently": "2.0.0",
"forever": "0.15.1",
"json-loader": "0.5.4",
"just-wait": "1.0.3",
"webpack": "1.12.11",
"just-wait": "1.0.4",
"webpack": "1.12.13",
"webpack-dev-server": "1.14.1"
},
"engines": {
Expand Down
3 changes: 1 addition & 2 deletions src/client.js
Original file line number Diff line number Diff line change
@@ -1,7 +1,6 @@
import React from "react";
import ReactDOM from "react-dom";
import * as ReactRouter from "react-router";
import * as history from "history";
import Transmit from "react-transmit";

import routesContainer from "containers/routes";
Expand All @@ -10,7 +9,7 @@ import routesContainer from "containers/routes";
* Fire-up React Router.
*/
const reactRoot = window.document.getElementById("react-root");
Transmit.render(ReactRouter.Router, {routes: routesContainer, history: history.createHistory()}, reactRoot);
Transmit.render(ReactRouter.Router, {routes: routesContainer, history: ReactRouter.browserHistory}, reactRoot);

/**
* Detect whether the server-side render has been discarded due to an invalid checksum.
Expand Down
4 changes: 2 additions & 2 deletions src/containers/Main.js
Original file line number Diff line number Diff line change
Expand Up @@ -92,8 +92,8 @@ class Main extends React.Component {
<h3>All-You-Need Features</h3>
<ul>
<li>Fully automated toolchain with npm run scripts</li>
<li>React 0.14 + React Router 1.0 on the client and server</li>
<li>Babel 6 automatically compiles ES2015 + ES7 draft</li>
<li>React 0.14 + React Router 2.0 on the client and server</li>
<li>Babel 6 automatically compiles ES2015 + ES7 stage-0</li>
<li>Webpack HMR for instant server updates</li>
<li>React Transform HMR for instant client updates</li>
<li>React Transmit to preload on server and hydrate client</li>
Expand Down
2 changes: 1 addition & 1 deletion src/containers/routes.js
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ import {Router, Route} from "react-router";
import Main from "./Main";

/**
* The React Router 1.0 routes for both the server and the client.
* The React Router routes for both the server and the client.
*/
module.exports = (
<Router>
Expand Down
5 changes: 2 additions & 3 deletions src/server.js
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,6 @@ import koaStatic from "koa-static";
import React from "react";
import ReactDOM from "react-dom/server";
import * as ReactRouter from "react-router";
import * as history from "history";
import Transmit from "react-transmit";

import githubApi from "apis/github";
Expand All @@ -28,7 +27,7 @@ try {
app.use(function *(next) {
yield ((callback) => {
const webserver = __PRODUCTION__ ? "" : `//${this.hostname}:8080`;
const location = history.createLocation(this.path);
const location = this.path;

ReactRouter.match({routes, location}, (error, redirectLocation, renderProps) => {
if (redirectLocation) {
Expand All @@ -41,7 +40,7 @@ try {
return;
}

Transmit.renderToString(ReactRouter.RoutingContext, renderProps).then(({reactString, reactData}) => {
Transmit.renderToString(ReactRouter.RouterContext, renderProps).then(({reactString, reactData}) => {
let template = (
`<!doctype html>
<html lang="en-us">
Expand Down

0 comments on commit 131bc92

Please sign in to comment.