Merge pull request #40 from muffinresearch/fix-deprecated-history-warning
Fix deprecated history warning
This commit is contained in:
Коммит
0fc588886b
|
@ -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')
|
||||
);
|
||||
|
|
Загрузка…
Ссылка в новой задаче