E
E
Eugene2019-06-26 13:22:53
React
Eugene, 2019-06-26 13:22:53

What are the options for displaying data with the API?

I receive data from the API, save it in state, and then it is rendered, because state has been updated. Even if I need the data once and then they are not up-to-date and I do nothing with them.
I can’t understand if there is a correct way to display this data directly, bypassing the state, or is it completely wrong?
When the data is deleted, changed, the feature of working through the state is added, it is understandable, but when they just need to be displayed one-time, is the approach through the state still correct?
PS It seems to me that due to the delay in receiving a response, the data still changes and you cannot do without state

Answer the question

In order to leave comments, you need to log in

1 answer(s)
A
Anton Spirin, 2019-06-26
@eugeneledenev

Data retrieved at runtime should be stored in the component state or the library's state management store when it is used. In both cases, at a minimum, you get a component update on a state change.

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question