Skip to content
This repository was archived by the owner on Sep 8, 2021. It is now read-only.

Commit 571f93a

Browse files
authored
Merge pull request #30 from marzelin/01
fix fetching initial state from redux store
2 parents 17162e4 + b4d5466 commit 571f93a

File tree

1 file changed

+4
-0
lines changed

1 file changed

+4
-0
lines changed

src/index.js

+4
Original file line numberDiff line numberDiff line change
@@ -20,6 +20,10 @@ class App extends React.Component {
2020

2121
componentWillMount() {
2222
store.subscribe(() => this.setState(store.getState()));
23+
// subscription takes place after Redux store initialization action
24+
// so listener won't update component's initial state -
25+
// the app state needs to be synchronized manually
26+
this.setState(store.getState());
2327
}
2428

2529
render() {

0 commit comments

Comments
 (0)