Last active
February 7, 2019 06:47
-
-
Save vldvel/e94a2ac0e3ab204d17253a9667a64a92 to your computer and use it in GitHub Desktop.
initActions in root
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
export const initActions = async dispatch => { | |
let updateTimeout; | |
updateMessages = async () => { | |
await dispatch(getNewMessages()); | |
updateTimeout = setTimeout(updateMessages, 500); | |
} | |
updateMessages(); | |
} | |
class App extends React.PureComponent { | |
componentDidMount() { | |
this.props.initActions(); | |
} | |
render() { | |
return ( | |
<div> | |
<Header /> | |
<Main /> | |
<Footer /> | |
</div> | |
); | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment