I recently started learning the MERN stack (MongoDB, Express, React, Node) and FLUX. Ive been using it for around 2 weeks now and I have been really enjoying it.
My understanding of FLUX is that is rely's on the following steps:
Actions: these are the payloads with some data and some context (type) in short objects, these are created by some helper functions as a result of an activity in the view(mostly). For example when user clicks on an add button, we will create an action which will contain infomation to be added and the context. All actions are sent to the dispacher.
Dispatcher: dispatcher works like a global hub which triggers all the listeners rgistered to it whenever an action is sent to it.
Stores: stores register themselves with dispatchers, when dispatcher broadcasts an actions arrival, stores update themselves if that action is relavant to those stores, and emit a change event which causes UI to get updated.
Views: Views are the html rendered components.
Each of these steps has its own directory in a simple todo list app I have created.
My question is:
If I wanted to run a separate routine, for example a routine on page load that checks whether a day has passed since the last record updated, and do something on the server/database based on that logic.
What would be the best way to call this routine from a page load for example?
Any help or advice is appreciated, Thank you in advance.