B
B
beefront172019-07-30 14:57:49
JavaScript
beefront17, 2019-07-30 14:57:49

Which approach is better for filtering/sorting, react/redux?

Good afternoon! Can you please tell me the best way to do filtering / sorting in a react / redux application?
The question is which is better: for each sorting / filtering event, make a new request to the server with the appropriate parameters, or save all the data in the state and work with it already?
In fact, there will not be much data, about 20 objects.
Would love to hear the pros/cons of both approaches.
Thank you!

Answer the question

In order to leave comments, you need to log in

1 answer(s)
A
Anton Spirin, 2019-07-30
@beefront17

1. If you have 20 objects that never change and are in fact used by your application anyway, then they can generally be loaded / added on the server side and, without making any requests, filter the data on the client side.
2. If there is a lot of data and it can change at any time, then you need to re-request for each filter change. To process user actions, it is better to use debounce.

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question