Комментарии:
But you are not checking if the state value is changin or not. You are just printing the value of e.target.value on CallAPI method. I tried this my state is not updating immedietly.
ОтветитьBrilliant
Ответитьthank you so much sir
Ответитьif we use setState method with callback will it fix the delay issue?
Ответитьyou didn't fixed the state delay, you just used another way to inform de data to your function
Ответитьthen what is the benefit of having state if every time we are hardcoding the values?
ОтветитьThankyou so much sir
ОтветитьSorry,...
the searchText used is only from the variable from callApi, not from the state's searchText
thanks bro
Ответитьthank you so much brother
Ответитьthanks bro, you saved me days of bug fixing ☺️
ОтветитьThanks.helped it
ОтветитьIn project it worked for me
Thank you 💓💓💓
you said 'setState' is async that's actually incorrect . setState is synchronous . React take time to update because of 'batch updating ' . That's means react will update states together to improve the performance by not making component render on every state
ОтветитьIf it’s not updating instantly then how serchtext value in h1 is getting updated
ОтветитьYou got me out of days of bug searching, thank you!
Ответитьso how to setValues properly?
Ответитьif you are passing one text field value ,thats fine. what if i will pass multilpe input text value to URL? suppose some id, and based on those ID i will fetch API.
ОтветитьThen what is the use of setState
Ответитьnice
Ответить