DEV Community

Discussion on: Express in React! React Backend! Whut?! 🤯

Collapse
 
taviroquai profile image
Marco Afonso

How better is compared to Next.js?

Collapse
 
renatorib profile image
Renato Ribeiro

not the same purpose

Collapse
 
taviroquai profile image
Marco Afonso

Considering rendering React in server side, Nextjs does this. What Am I missing?

Thread Thread
 
cliffordfajardo profile image
Clifford Fajardo • Edited

This is adding another level of abstraction on top of writing vanilla javascript code to generate a server code; so instead of writing the code that looks the your typical functional that looks like an express handler, you'd write this it seems

react-express -> spits out server infrastructure code

app.get('/', function (req, res) {
  ............other boilerplate code
  res.send('hello world')
})
Enter fullscreen mode Exit fullscreen mode

Side note: I really appreciated the power of declarative languages and built a better mental model on the when/why you would do this after reading Ch2 of Designing Data Intensive Applications by Martin Kleppman

A declarative query language can be more attractive because:

  • it is typically more concise and easier to work with than an imperative API

  • But more importantly, it also hides implementation details of the underlying code making it possible for the system to introduce performance improvements without requiring any changes to userland code Other examples

    • (SQL, you write declarative queries, the engine/query optimizer handles trying to generate the most efficient code for you under the hood given the declarative code)
Collapse
 
orkhanjafarovr profile image
Orkhan Jafarov

This one is http server that described with jsx. It can render regular react dom components when you pass it to get response (like a template engine does)
I’m working on its package and it will be possible to play with that in sandbox.

Collapse
 
taviroquai profile image
Marco Afonso

Oh I see the difference is declaring with JSX... ok.
But at the end will do the same SSR, right?

Thread Thread
 
orkhanjafarovr profile image
Orkhan Jafarov

It gonna do only SSR for now, it's more about backend/http-server part than frontend

Thread Thread
 
taviroquai profile image
Marco Afonso

I like JSX... looks nice =)