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

What is happening when Matlab is starting a "parallel pool"? -

php - Cannot override Laravel Spark authentication with own implementation -

Qt QGraphicsScene is not accessable from QGraphicsView (on Qt 5.6.1) -