yükleyin tepki-yönlendirici sürüm 3.0
npm install --save [email protected]
veya
yarn add [email protected]
Ardından her iki yöntemler işe:
Yöntem `tepki-router` yeni sürümlerinde ile 1
import { Router, useRouterHistory } from 'react-router';
import {createMemoryHistory} from 'history';
import routes from './routes';
const appHistory = useRouterHistory(createMemoryHistory)({});
ReactDOM.render(
<Router history={appHistory} routes={routes}/>,
document.getElementById('root')
);
Yöntem 2
import { Router, browserHistory } from 'react-router';
import routes from './routes';
ReactDOM.render(
// or hashHistory
<Router history={browserHistory} routes={routes}/>,
document.getElementById('root')
);
, sen tarih yaratıcısı olsun “tarih” paketinden. [Dokümanlar] 'a bir göz atın (https://github.com/rackt/react-router/blob/1.0.x/docs/guides/basics/Histories.md). –
Usta şubeden, aslında tarayıcı-tarayıcıyı şimdi tepki-yönlendiriciye dönüştürdüğüne inanıyorum. – hoodsy
2.0 rcs ile, sunucuda tanımsız alıyorum ... ve tarayıcımda '' 'connect.js? 243b: 60 Uncaught TypeError: finalMapStateToProps bir işlev değil '' (bir Redux sorunu gibi görünüyor). Yönelticiyi '' 'renderToString''' – hoodsy