Full-Stack React Developers? A Light Take on a New Trend

Vitalii Petrenko
2 min readOct 28, 2023

--

Recently, at the Next Conf, a surprising snippet of code was showcased:

At first glance, it seems like a lighthearted jest. A React component directly executing an SQL query? But, as time and technology progress, today’s joke can often become tomorrow’s reality.

Here’s why integrating frontend and backend in this manner might not be the future we’re looking for:

  1. Security Concerns: Direct SQL can open doors to vulnerabilities like SQL injection, especially if inputs, such as slug, aren't handled with care.
  2. Muddling Logic: One cornerstone of software development is the separation of concerns. Ideally, frontend and backend remain distinct realms. This ensures modularity and makes the codebase more maintainable.
  3. Error Handling: Direct SQL in components leaves many questions. What if the query fails? Is there a retry mechanism?
  4. Profiling Challenges: Direct SQL within React components might make app profiling an uphill task.
  5. Optimization Issues: This can lead to a slew of unnecessary database queries, affecting performance.
  6. Scalability Concerns: Large-scale apps or ones with high traffic might struggle with this approach due to concurrent database access.
  7. Blurring Responsibilities: Here, the clear boundary between frontend and backend is lost.

It’s often better to keep frontend and backend as separate entities: employ API endpoints for database interactions, letting frontend manage just data exchange.

On a lighter note, this revelation brought to mind a joke:

Developer 1: “So, you’re a full stack developer now? What’s your backend tech?”

Developer 2: “React.”

Developer 1: “No, I meant for the backend?”

Developer 2: “Exactly, React! Now that we have direct SQL in components, React is my backend too!”

Developer 1: “At this rate, our jokes about development will soon not be jokes anymore.”

Conclusively, while embracing innovation is pivotal, it’s equally essential to prioritize secure, scalable, and maintainable coding practices.

Feedback, shares, and likes are welcome! If you’ve encountered similar innovative (or quirky) coding trends, do chime in with your experiences or thoughts!

Update:

In the near future, Next.js 27 will allow kernel interfacing at the component-level

--

--

No responses yet