How to update the value dynamically after api call #17
-
Hi, Please help me on this, I am new to React Native, i am using this control, but its value is not changing after api response, i need to update its value dynamically.
I am using above code but its not working. |
Beta Was this translation helpful? Give feedback.
Replies: 3 comments
-
Can you please share your code snippet if possible, and please elaborate on your issue. I think what you want to do after API call is:
assuming your useState hook is declared like this: Make a copy using spread operator and update only those values you want using setState. Please refer to this link: Example Code, API call is mimicked in line no. 46 useEffect |
Beta Was this translation helpful? Give feedback.
-
Hi, Thanks for replying on this, Actually i want to replace the complete value of list after api call. Please check the below code what i have used.
|
Beta Was this translation helpful? Give feedback.
-
I think this would update your list: use
instead of
please refer to this guide: useState in React: A complete guide for a better understanding of React's useState hook. your code should look like this:
|
Beta Was this translation helpful? Give feedback.
I think this would update your list:
use
instead of
please refer to this guide: useState in React: A complete guide for a better understanding of React's useState hook.
your code should look like this: