Replies: 5 comments 7 replies
-
Well, SSR and hydrating to SPA (like you describe) will never be faster than SSR and partial hydration (how I use NanoJSX). What makes a site fast, is less JavaScript. The point of Nano JSX is to ship as few bytes as possbile. I have already build an entire webshop using only one HTML file and one JavaScript file (CSS is included in the HTML). Total size (excluding lazy loaded images) is only 19KB. Even if it seems that client-side routing (like in react) is fast. Low end phone and slow connections have to deal with 50+ KB before interacting with your site. Yes, please share the video. Becaus I'm not sure yet what the benefits of inertiajs is. My opinion
|
Beta Was this translation helpful? Give feedback.
-
I don't know if inertiajs.com was build using inertiajs Once you have visited every page on nanojsx.github.io, the browser only had to download a total of 92.3KB. Why? Because navigation to another page, will not re-fetch already cached files like the logo or javascript. So even after reading the nanojsx docs for 1h or more, the browser would only have downloaded 100 KB. |
Beta Was this translation helpful? Give feedback.
-
Here is the video demonstrating Laravel with spatie SSR and Nano JSX with partial hydration. It is really fast even there is much more room to optimize. I don't have a setup with Nano JSX and InertiaJS yet. This should only give an insight how easy and fast Laravel with SSR in combination with Nano JSX. Sorry for not so good englisch, I'm from Germany :) |
Beta Was this translation helpful? Give feedback.
-
@yandeu since inertiaJS is not using typescript at all and the existing packages with SSR support (react, vue-2, vue-3) are not using typescript, what would you suggest? Using the configuration you published in this example with commonJS for I already setup a dev environment and tried Laravel, InertiaJS and Nano JSX with the typescript configuration. This is kind of annoying, because I have to define so many types. This would be actually no problem and there are also guides for installing Laravel and Inertia with React and TypeScript, but when I check the InertiaJS issues, I see a lot of people complaining on having issues when using typescript. The development of the @inertiajs/nano-jsx adapter is possible for sure. I already have it almost running. |
Beta Was this translation helpful? Give feedback.
-
I've written a server-side Inertia adapter for Deno. It's actually not too hard, mostly just a matter of listening for https://github.com/jcs224/oak_inertia However, I tried to create a client-side adapter for SolidJS and it is much more difficult. I haven't been able to pull it off actually. Some guidance is needed for that. |
Beta Was this translation helpful? Give feedback.
-
Hey,
I already told you I experimented a lot with React, Laravel and spatie/laravel-server-side-rendering. My goal was to create a server side rendered SPA, but I could't reach the desired results.
In the last days I created a laravel-nano-jsx-client-side-preset repo, which I will release in the next days. It is based on wewowweb/laravel-svelte-preset. As the preset was ready, I continued developing with focus on server side rendering. What helped me understanding the actual process of an isomorphic app, was reading the docs from InertiaJS SSR and this article.
If you checkout the SSR Demo, you see only the first paint of the website is rendered server side, then it switches over to client side navigation and is using XHR to get the data from the server.
I tried to rebuild the process with Laravel, spatie/laravel-server-side-rendering and Nano JSX and for sake it is working and very fast. Since the spatie package is not actively under development and the way I archived the results is not 100% best practice code, I started sponsoring InertiaJS, to get access to the early access SSR feature. Today I setup an app with Laravel, InertiaJS and React for testing purpose and I love it totally.
If you checkout awesome-inertiajs, it has already support for Vue, React, Svelte and Mithril. This is accomplished with app specific "adapters" which are programmed by the InteriaJS devs. Today I talked to them and asked if someone is interessted in creating an adapter for InertiaJS and Nano JSX, but they said "I don't think there will any other official adapters, unless there's a framework that's really popular. Maintaining these adapters requires extensive knowledge of the framework itself. You could try making the adapter yourself, although documentation for client-side adapters is pretty limited."
I'm now totally into this. I want to create an adapter to make not only the client side Nano JSX preset for Laravel, but server side for InertiaJS. I can just dream of the actual result you will archive with those two frameworks. It will be the best frontend setup ever.
So I wanted to ask, Yannick do you think this is a good idea? And if I gonna make the adapter, can I count on your support while developing?
Later I will make a small video of what I got.
Beta Was this translation helpful? Give feedback.
All reactions