React query

optional chaining[

>data is fetched in data varible..

in render:--data?data.map()...


useEffect hook:data fetching and 

use state hook :

to manintain componet state like 

loading, error or resulting data..


[data needed throughout the app]:

state management library[redux]

 


state management are not great

for working with asynchronous or

server state.


 client state:

presisted in your app memory

and accessing or updating it 

synchronou



server state


persisted remotely and requires

asynchronous api's for fetching or 

updating.. 


has shared ownership


caching


deduping multiple request for the

same data,


updating state data in the background

performance optimization etc.


project setup:

>npx react app reactquerydemo


Note:--

json-server[get and post]

1.make db.json

2.add  "server-json":"json.server --watch db.json --port 4000"


react-router-dom:-

Traditional super hero   Rq Super hero


Fetch data:-useeffect() and usestate()

................................................................................

React Query:--

useQuery()





Comments

Popular posts from this blog

interview questions js[ Anurag Singh ProCodrr]

reactnative_creation