Skip to content

added react-router 2.0.0-rc4 #5

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 2 additions & 4 deletions modules/client.js
Original file line number Diff line number Diff line change
@@ -1,7 +1,6 @@
import React from 'react'
import { match, Router } from 'react-router'
import { match, Router, browserHistory } from 'react-router'
import { render } from 'react-dom'
import { createHistory } from 'history'
import routes from './routes/RootRoute'

const { pathname, search, hash } = window.location
Expand All @@ -11,8 +10,7 @@ const location = `${pathname}${search}${hash}`
// loading route/component code for the initial location
match({ routes, location }, () => {
render(
<Router routes={routes} history={createHistory()} />,
<Router routes={routes} history={browserHistory} />,
document.getElementById('app')
)
})

5 changes: 2 additions & 3 deletions modules/server.js
Original file line number Diff line number Diff line change
@@ -1,15 +1,15 @@
import http from 'http'
import React from 'react'
import { renderToString } from 'react-dom/server'
import { match, RoutingContext } from 'react-router'
import { match, RouterContext } from 'react-router'
import fs from 'fs'
import { createPage, write, writeError, writeNotFound, redirect } from './utils/server-utils'
import routes from './routes/RootRoute'

const PORT = process.env.PORT || 5000

function renderApp(props, res) {
const markup = renderToString(<RoutingContext {...props}/>)
const markup = renderToString(<RouterContext {...props}/>)
const html = createPage(markup)
write(html, 'text/html', res)
}
Expand Down Expand Up @@ -43,4 +43,3 @@ http.createServer((req, res) => {

}).listen(PORT)
console.log(`listening on port ${PORT}`)

2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@
"history": "^1.13.1",
"react": "^0.14.2",
"react-dom": "^0.14.2",
"react-router": "^1.0.0",
"react-router": "^2.0.0-rc4",
"webpack": "^1.12.6"
},
"scripts": {
Expand Down