Answer the question
In order to leave comments, you need to log in
How to draw the data in this case?
There is data that I get from the server depending on the url. The difference between these data is only in their date of creation. i.e. when you click on the button - I get yesterday's data, on the second button - today's, on the third - future. I sort the data by date on the back. i.e. for each url its own controller is obtained. The problem is that when I click on the "today" button, I need to display data for today (separating them by title) and for yesterday, respectively, when clicking on "yesterdays", for yesterday and for today. The question is how to do it? 1. Get data by url for example /today , thus: two arrays of data sorted (today and yesterday), set them to the store and render. 2. Get them all in one go (today, yesterday, future), sort at the front and when switching on different urls just take data from the store? without requests to the back. How to be?
Answer the question
In order to leave comments, you need to log in
For me, it is better to separately make requests for today and yesterday. After all, this is the essence of React, that each component should only call those requests whose data it needs.
Why make a request for everything, if a person may not even click on these buttons at all, in total you just have an extra request and extra data.
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question