Answer the question
In order to leave comments, you need to log in
React-redux-router not working?
Hello, what could be the reason that routing is not working in a redux application. Used this tutorial . Actually the code itself:
import ReactDOM from 'react-dom';
import React from 'react';
import { createStore, combineReducers } from 'redux';
import { Provider } from 'react-redux';
import { Router, Route, browserHistory } from 'react-router';
import { syncHistoryWithStore, routerReducer } from 'react-router-redux';
import App from './containers/App.js';
import * as reducers from './reducers/Reducers';
import './main.scss';
const store = createStore(combineReducers({...reducers, routing: routerReducer}));
const history = syncHistoryWithStore(browserHistory, store);
ReactDOM.render(
<Provider store={store}>
<Router history={history}>
<Route path='/' componen={App}></Route>
</Router>
</Provider>,
document.getElementById('root')
);
import React from 'react';
import Sidebar from '../components/Sidebar';
export default class App extends React.Component {
render() {
return (
<div className="app">
<Sidebar />
{this.props.children}
</div>
);
}
}
Answer the question
In order to leave comments, you need to log in
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question