Don't get angry, Just listen to me
Ask yourself few questions
- Why you hate PHP?
- How much time it will take for you to build simple crud based APIs in Node.js (with a framework of your choice) and then integrating them into React.js app (client-side)?
- Will you fix something which isn't broken?
Let me answer these questions for you
- I don't like it's syntax, why explode when I can split and It's traditional way of full-stack development which merges (--force) server and client together that makes it way harder to debug.
- I have a boilerplate, so it will take 1 hour or maybe less.
- NO! NEVER!
Let's pull Next.js into the game.
- Isn't Next.js doing same but the cool way.
- What's the point of using server actions then and pushing my self into hell of bugs?
- So why Next.js did this, we don't need it, we don't ask for it.
I know some of you already got triggered because you have put countless hours debugging your server actions and server components bugs and now you can call yourself a Ninja-level Next.js Geek because at some point with the help of prayers of your parents, you are able to find fixes for each of the bug - Congrats BTW
For those who are listening with patience, let's continue.
I have used Server Actions, they seem to be great at first glance but when I use them in my projects, Oh man, I got lost into the pool of bugs, unhelpful error messages and what's not, I literally got crazy at point where my manager is continuously following me for update and I'm resolving a bug related to "headers" which has appeared during production build and not in dev environment, and that's not just one time incident.
Incidents like this happens time by time and I realize that for building simple applications, I got into numerous amount of bugs and my code looks like a sh*t, what will happen when I take it to complex projects (I just don't want to imagine), why I'm wasting my time, I can just do that in couple of hours If I just create a separate project for backend and build APIs for everything.
And guess what? I did the same, and then I'm able to take a deep breath of fresh air and my mental health is stable now. It takes just 2 days (dedicatedly) for me to transform all server actions into Node.js (express) based APIs and integrating them with axios and React Query. It works like a charm, No performance issues, No weird bugs, No cache issues, I can deploy it anywhere, All set and running in Production peacefully.
Here's what I have learned during all this cumbersome.
- Don't run after shiny trends for a sake of looking cool.
- Don't ever try any new feature (which seems to be providing a solution that needs a problem) into your production code or just don't waste your time on that.
- Stability always and forever wins.
- The problem you solve matters, the feature or the way you use to solve it doesn't.
- Experience of a developer is worth more than Developer Experience or DX
And the most important one
Don't use Server Actions
If someone from React's Core Team or Next.js Core Team reading this, My friend do focus on frontend, there's a lot more to explore, although you are doing great but React's state management sucks, React's performance sucks, fix them first then move to backend side of things, Take inspiration from your friends such as Angular and Vue.
That's it. Have a good day. Don't take it personally
Top comments (1)
Agree