reactjs - Best Practice: When to throw away unwanted data from asynchronous call -


i have asynchronous middleware accesses remote api , dispatches redux.

i accessing existing api returns large chunk of data, of not need. there established best practice when discard unwanted elements data? far can see could:

1 - filter out when received , pass need store.

2 - store in store when received , use selector or mapstatetoprops extract need render.

3 - store , extract , filter out need within component.

what others think?

in case can't change api use streams or @ least pagination, go option no. 1.

  • try work least amount of data necessary the
    job. general rule , doesn't apply redux!
  • try keep store flat possible.
  • try minimize data involved in actions lead change in store

with said, filter out unused data right when api response comes in.


Comments

Popular posts from this blog

Is there a better way to structure post methods in Class Based Views -

reflection - How to access the object-members of an object declaration in kotlin -

php - Doctrine Query Builder Error on Join: [Syntax Error] line 0, col 87: Error: Expected Literal, got 'JOIN' -