Whenever I need to deal with time in redux, I generally set up an Action that uses setInterval to dispatch another action every 100ms or to Redux with the current time, which updates the reducer state with the current time. That way, time becomes completely reactive and declarative and updates work fine. The action is started from componentDidMount.
That being said, I didn't want to just check for the time every second (or so), I wanted to just set a countdown to midnight and let the app refresh from there.
That being said, thank you, that'll be really helpful for when I do something like that outside of Electron!
For further actions, you may consider blocking this person and/or reporting abuse
We're a place where coders share, stay up-to-date and grow their careers.
Whenever I need to deal with time in redux, I generally set up an Action that uses setInterval to dispatch another action every 100ms or to Redux with the current time, which updates the reducer state with the current time. That way, time becomes completely reactive and declarative and updates work fine. The action is started from componentDidMount.
That's a good idea to have it live in the action.
That being said, I didn't want to just check for the time every second (or so), I wanted to just set a countdown to midnight and let the app refresh from there.
That being said, thank you, that'll be really helpful for when I do something like that outside of Electron!