The UI binds to the data stored on the local device's database (Onyx).
- Onyx - A Pub/Sub library to connect the application to the data stored on disk.
For example, a person inputs data, the UI calls an action and passes the user's input.
Use fallbacks and default values to handle data that can be missing.
Do not wait for one action to finish before calling another action. If you find yourself running into this problem, you should rethink how the component is built. Ask for help in our open source room and there will be plenty of people willing to help you think through a better approach. They can be tricky sometimes!
Returning a promise is the first sign that the rule above this is being broken. Let the UI react to changes to Onyx data that is modified in the action instead.
- Library files that are not connected or associated to any UI SHOULD use Onyx.connectWithoutView() to subscribe to changes in Onyx data
Library files are located in /src/lib but excluding the actions in /src/lib/actions which have their own rule below.
Exclusions:
- If a library method is used by an action method (like a utility), then follow the rule below for action methods.
Pure functions are ones that have all necessary data passed as parameters and do not create side-effects.