After a few months away from web development, I have decided to upgrade my coding skills and update my stack.
I have many projects pending on Github so it is a good time to resume what I have started long ago.
AI helper… is helping?
Using Chat GPT and Geminis is a great help for developers. It gives you exactly the code I want (sometimes outdated… but!) saving you a lot of headaches. However, asking code block by block, and sending all the errors to be solved by them (AI), is not the best way to innovate. After all, these helpers are just repeating the most used code by others.
It made me feel like a kid asking for “something to eat” and my AI parents are just giving me ice-cream and candies. I will die obese or worse.
So I changed my “tell me how to fetch from an endpoint using NextJS” to “when using nextjs in 2024, what is the suggested way to call an api when page loads. include other libraries if necessary”
ChatGPT (free 4.0), introduced me to:
- NextJS Server Actions
- React-Query
- Options to pick based on my requirements.
Damn!, I feel smarter already. Now I have to choose:
Choosing the Right Method
- Server Components: Use for data that should be fetched and rendered on the server for SEO and performance benefits.
- React Query: Use for dynamic, interactive data that may change often or requires client-side state management.
- useEffect Hook: Use for simple client-side data fetching scenarios without the need for advanced caching or state management.