Answer the question
In order to leave comments, you need to log in
How to update state without reloading?
When sending data through a form (post), the data gets into json and is displayed on the page. To see the new data, you need to manually reload the page.
How to display this data without reloading?
Data is an array in state ={list: []}
Answer the question
In order to leave comments, you need to log in
how is the "data gets into json and displayed on the page", through this.setState?
- After POST, make a GET on new data, put it in the state
- See if some response of the POST request comes, maybe there is enough data from it to update the state
- In addition to sending data in the POST, also update them in stete
...
Depends on the specific task and API.
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question