Merge pull request #40 from muffinresearch/fix-deprecated-history-warning

Fix deprecated history warning
This commit is contained in:
Stuart Colville 2016-02-26 09:07:58 +00:00
Родитель fe6c5b5111 0e022b195b
Коммит 0fc588886b
5 изменённых файлов: 10 добавлений и 21 удалений

Просмотреть файл

@ -47,7 +47,6 @@
"eslint": "2.2.0",
"eslint-config-airbnb": "6.0.2",
"eslint-plugin-react": "4.1.0",
"history": "2.0.0",
"react-dom": "0.14.7",
"react-hot-loader": "1.3.0",
"react-transform-hmr": "1.0.2",

Просмотреть файл

@ -1,12 +1,9 @@
import React from 'react';
import { render } from 'react-dom';
import { Router } from 'react-router';
import createBrowserHistory from 'history/lib/createBrowserHistory';
import { Router, browserHistory } from 'react-router';
import routes from './routes';
const history = createBrowserHistory();
render(
<Router children={routes} history={history} />,
<Router children={routes} history={browserHistory} />,
document.getElementById('react-view')
);

Просмотреть файл

@ -1,4 +1,3 @@
import createLocation from 'history/lib/createLocation';
import express from 'express';
import helmet from 'helmet';
import path from 'path';
@ -55,15 +54,15 @@ export default function(routes) {
app.post('/__cspreport__', (req, res) => res.status(204));
app.use((req, res) => {
const location = createLocation(req.url);
match({ routes, location }, (err, redirectLocation, renderProps) => {
match({ routes, location: req.url }, (err, redirectLocation, renderProps) => {
if (err) {
console.error(err); // eslint-disable-line no-console
return res.status(500).end('Internal server error');
}
if (!renderProps) return res.status(404).end('Not found.');
if (!renderProps) {
return res.status(404).end('Not found.');
}
const InitialComponent = (
<RouterContext {...renderProps} />

Просмотреть файл

@ -1,12 +1,9 @@
import React from 'react';
import { render } from 'react-dom';
import { Router } from 'react-router';
import createBrowserHistory from 'history/lib/createBrowserHistory';
import { Router, browserHistory } from 'react-router';
import routes from './routes';
const history = createBrowserHistory();
render(
<Router children={routes} history={history} />,
<Router children={routes} history={browserHistory} />,
document.getElementById('react-view')
);

Просмотреть файл

@ -1,12 +1,9 @@
import React from 'react';
import { render } from 'react-dom';
import { Router } from 'react-router';
import createBrowserHistory from 'history/lib/createBrowserHistory';
import { Router, browserHistory } from 'react-router';
import routes from './routes';
const history = createBrowserHistory();
render(
<Router children={routes} history={history} />,
<Router children={routes} history={browserHistory} />,
document.getElementById('react-view')
);