Skip to content

Instantly share code, notes, and snippets.

@dbani-dev
Last active October 27, 2017 03:18
Show Gist options
  • Save dbani-dev/3c7acf205c97cc9d9773408941b46f26 to your computer and use it in GitHub Desktop.
Save dbani-dev/3c7acf205c97cc9d9773408941b46f26 to your computer and use it in GitHub Desktop.
class ToolbarStatus extends Component {
constructor(props) {
super(props);
}
componentWillReceiveProps(nextProps) {
if (!nextProps.isFetching && !nextProps.isFailure) {
this.timer = setInterval(this.tick, 30000);
}
}
componentWillUnmount() {
clearInterval(this.timer);
}
tick = () => {
this.props.timestampUpdate(); // Doesnt pass action arguments '#0001'
}
render() {
return (
)
}
}
class Events extends Component {
constructor(props) {
super(props)
}
render() {
<ToolbarStatus timestampUpdate={() => this.props.eventsTimestampUpdate('#0001')} />
);
}
}
const mapDispatchToProps = (dispatch) => {
return
eventsTimestampUpdate: (pointId) => dispatch(eventsTimestampUpdate(pointId)),
}
}
export default connect(mapStateToProps, mapDispatchToProps)(Events);
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment