3 ms·
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
by franciscop 10mo 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.
- alfonsodev 10mo agoHow do you handle interaction ?
- 8n4vidtmkvmk 10mo agoI 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 10mo agoI 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!
- franciscop 10mo agoNo 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.
- thecupisblue 10mo agoI'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 10mo agoThat'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 https://server-js.com/documentation#jsx - Source of the main renderer: https://github.com/franciscop/server-next/blob/master/src/jsx/jsx-runtime.js https://github.com/franciscop/server-next/blob/master/src/js...
- satvikpendem 10mo agoIsn'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.
- franciscop 10mo agoYes, it's a JSX template engine. I'm pointing out that this blog post was the main inspiration to learning how "straightforward" JSX was under the hood.