Why I avoid useEffect For API Calls and use React Query instead
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-query-useEffect
🧭 Build Login/Register API Server w/ Authentication | JWT Express AUTH using Passport.JS and Sequelize
https://youtu.be/VWEJ-GhjU4U
🧭 Turn Design into React Code | From prototype to Full website in no time
https://youtu.be/0xhu_vgKZ8k
🧭 Watch Tutorial on Designing the website on Figma
https://youtu.be/SB3rt-cQZas
🧭 Watch Create a Modern React Login/Register Form with smooth Animations
https://youtu.be/-bll7l-BKQI
🧭 Debug React Apps Like a Pro | Master Debugging from Zero to Hero with Chrome DevTools
https://youtu.be/_rnxOD9NKAs
🧭 Master React Like Pro w/ Redux, Typescript, and GraphQL | Beginner to Advanced in React
https://youtu.be/M_Oes39FNuk
🧭 Learn Redux For Beginners | React Redux from Zero To Hero to build a real-world app
https://youtu.be/_rnxOD9NKAs
🧭 Introduction to GraphQL with Apollo and React
https://youtu.be/eCO6MvvRhXk
🐦 Follow me on Twitter: https://twitter.com/ipenywis
💻 Github Profile: https://github.com/ipenywis
Made with 💗 by Coderone