Skip to content

Commit 5c7733a

Browse files
committed
fix bugs on change page via redux
1 parent 30ca7fb commit 5c7733a

File tree

2 files changed

+2
-9
lines changed

2 files changed

+2
-9
lines changed

src/containers/home/index.js

+1-6
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,4 @@
11
import React from 'react'
2-
import { push } from 'react-router-redux'
32
import { bindActionCreators } from 'redux'
43
import { connect } from 'react-redux'
54
import {
@@ -24,7 +23,6 @@ const Home = props => (
2423
<button onClick={props.decrementAsync} disabled={props.isDecrementing}>Decrement Async</button>
2524
</p>
2625

27-
<p><button onClick={() => props.changePage()}>Go to about page via redux</button></p>
2826
</div>
2927
)
3028

@@ -38,10 +36,7 @@ const mapDispatchToProps = dispatch => bindActionCreators({
3836
increment,
3937
incrementAsync,
4038
decrement,
41-
decrementAsync,
42-
changePage: () => {
43-
dispatch(push('/about-us'))
44-
}
39+
decrementAsync
4540
}, dispatch)
4641

4742
export default connect(

src/index.js

+1-3
Original file line numberDiff line numberDiff line change
@@ -2,8 +2,7 @@ import React from 'react'
22
import { render } from 'react-dom'
33
import { Provider } from 'react-redux'
44
import { Router, Route } from 'react-router'
5-
import createHistory from 'history/createBrowserHistory'
6-
import store from './store'
5+
import store, { history } from './store'
76
import App from './containers/app'
87
import Home from './containers/home'
98
import About from './containers/about'
@@ -12,7 +11,6 @@ import 'sanitize.css/sanitize.css'
1211
import './index.css'
1312

1413
const target = document.querySelector('#root')
15-
const history = createHistory()
1614

1715
render(
1816
<Provider store={store}>

0 commit comments

Comments
 (0)