Remix.run Logo
franciscop 2 days ago

This is an amazing resource to understand the internals/potential internals, and led me to build a small renderer that I've been using to amazing success for my own alt backend renderer. I now can do it like this:

    export default server()
      .get('/', () => <div>Hello world</div>)
      .get(...);
I've been using Bun's JSX transformer as well to do the transpilation, and since it's just a renderer on the backend I don't need to worry about events or hooks, just the rendering step. For this, the article was amazing and I learned a lot.
satvikpendem 2 days ago | parent | next [-]

Isn't this just a JSX template engine? For anything interactive you still need JS on the frontend. And then you essentially recreate React Server Components.

thecupisblue 2 days ago | parent | prev | next [-]

I'm actually about to release something similar, if you're interested would love to share it with you - getting some feedback would really help a lot.

franciscop 2 days ago | parent [-]

That's very nice, sure, thanks! Would love to see what others are working on. My very minimal implementation and docs are here, not really yet in my public projects, I've only used it for experiments:

- Documentation: https://server-js.com/documentation#jsx

- Source of the main renderer: https://github.com/franciscop/server-next/blob/master/src/js...

alfonsodev 2 days ago | parent | prev [-]

How do you handle interaction ?

franciscop 2 days ago | parent | next [-]

No interaction built in for this kind of simplified use-case, it's just like one of the old "template engines" of the old day, just in JSX/TSX. It's actually much better than expected, I used to dislike that all the old templates had something "off" for me; either they invented their own syntax for logic that you needed to learn besides normal JS (think Handlebars, Pug, etc), or they were in JS-like and with an odd HTML syntax that made sharing between plain HTML and whichever language very hard (think Pug/Jade).

With JSX templating, it's a subset of React, so you can directly share "up"t, and sharing "down" is very easy as well (just removing interaction), since both use the same syntax.

8n4vidtmkvmk 2 days ago | parent | prev [-]

I wrote something like this too. If i need interaction, i did something with the onclicks so it just sends the function definition to the client and calls that. Its not as powerful as react but you can do basic stuff. Its good if your site is mostly static.

franciscop 2 days ago | parent [-]

I was strongly thinking about doing that, but I think I prefer (for now) explicitly not having events, than having events that work kinda similar but not the same. Did you end up publishing it? Would love to have a look!