I’m building a React app that gets its data from a local API. The data is just an array with about 500 objects. The app has different views, each of them requiring a different subset of the array. How would you structure API and app? I have two ideas:
The app gets the data once from a unique API endpoint, and filters the data each time a view loads. Pros: simple API. Cons: more processing of data each time a view loads.
Each app view has its own API endpoint, so to get the data for a view it just fetches the whole data from that API endpoint. Pros: less processing of data each time the view loads. Cons: more complicated API, and more fetching of API data.
What would you recommend?