Why I avoid useEffect For API Calls and use React Query instead
CoderOne CoderOne
101K subscribers
209,280 views
0

 Published On Oct 9, 2022

If you are like me, always using use effect whenever you need to grab data from an API then wait for it to be fetched and let the React component render it, Well, this is what most people usually do too! Don't surprised cause it's the most obvious way and straightforward way to do it. But we never thought about improving it right? Likely for us, the team behind React Query built this amazing library to solve this problem and simplify our lives as developers. No more effect, the code is simple and maintainable, anyone can read through the code and it handles all the fetching states for you!


⭐ Timestamps ⭐
00:00 Intro
00:37 Why React query?
01:32 What's wrong with useEffect?
03:53 Same code but in React Query
05:43 So much easier code!
08:06 No need for a global store (aka Redux)
13:35 React Query cache is so smooth
16:30 Mutations makes it simpler


⚡️ Redux Alternatives Repo
https://github.com/ipenywis/react-que...



🧭 Build Login/Register API Server w/ Authentication | JWT Express AUTH using Passport.JS and Sequelize
   • Build Login/Register API Server w/ Au...  

🧭 Turn Design into React Code | From prototype to Full website in no time
   • Turn Design into React Code | From pr...  

🧭 Watch Tutorial on Designing the website on Figma
   • I Design a onecolor Website in 1 hour...  

🧭 Watch Create a Modern React Login/Register Form with smooth Animations
   • Create a Modern React Login/Register ...  

🧭 Debug React Apps Like a Pro | Master Debugging from Zero to Hero with Chrome DevTools
   • Debug React Apps Like a Pro | Master ...  

🧭 Master React Like Pro w/ Redux, Typescript, and GraphQL | Beginner to Advanced in React
   • Master React Like Pro w/ Redux, Types...  

🧭 Learn Redux For Beginners | React Redux from Zero To Hero to build a real-world app
   • Debug React Apps Like a Pro | Master ...  

🧭 Introduction to GraphQL with Apollo and React
   • Introduction to GraphQL with Apollo a...  


🐦 Follow me on Twitter:   / ipenywis  
💻 Github Profile: https://github.com/ipenywis

Made with 💗 by Coderone

show more

Share/Embed