I'm trying to use the data returned by a single fetch request in multiple modules that consume that data. Basically, what I have now is an API returns some JSON that will be used to populate a dropdown list of items and also used to get additional information associated with an item when a user makes a selection from that dropdown.
I have 3 modules: One that exports a function that makes the fetch request and returns a promise, and the two others that import that function and use the promise.then() syntax to populate the appropriate variables using callbacks when it resolves. This makes it so there are two fetch requests made when the application runs.
Sorry if this is a newbie question, is there a way to make a single fetch request and consume the returned data in multiple modules when it resolves?
Appreciate any help