I am working in a large React App. In my top level parent component, I am adding some info (user data from login service) to local storage through a Flux action dispatch. Once that action has dispatched, the rest of the app is rendered but the visibility of some components is dependent on the status of that data in local storage (i.e. user read permission). Note that this is all validated on the server-side as well when I query to collect the data to populate these components, I just want to render them in the most efficient way.
Since these components are not attempted to be rendered until after the Action that adds the permission data has been dispatched can I assume that the permission data will be available to read from local storage in the constructor/componentWillMount of the child components? Or do I need to handle potential latency between writing to local storage and reading from it?
Edit: As per the comment below, I can store my user permissions in the Store instead which resolves that issue.
However, I also get a URI for an API from the login service that may change depending on the user. This URI is used for ajax calls in functions that are called by actions dispatched when the child components are mounted. Since this is a static entity, not a component of state, local storage seems like the better place to hold this over the store. So the latency question above still stands for this aspect, is it safe to assume that as soon as the child component mounts and the ajax call is triggered the URI will be available to read from local storage? Or do I need to handle potential latency.