I've seen this pattern a lot recently but haven't figured out what the extra complexity gets you
I've seen this pattern a lot recently but haven't figured out what the extra complexity gets you
There's also a _ton_ of preexisting React components you can generally drop in and use, which is less true these days with something like a Django template.
You also have the option of doing SSR and then doing more dynamic stuff on the client side, as a sort of optimization (and plain better user experience than making _more_ server requests to get the initial page state loaded).
Type safety is incredibly important if you're lots of logic in a language, which is why TS is great for SPAs. Does the type safety of TS get you anything if you're just doing SSR with not a whole lot of logic in TS? All of your application logic will be on the Python side of things.
>You also have the option of doing SSR and then doing more dynamic stuff on the client side
Isn't this just the old-school way of doing things before SPAs came around? i.e you render the page on the server and then add dynamics features using JS. I think the new way of doing this is with htmx, hotwire, etc.
The biggest benefit for SSR in my opinion is SEO + first load is fast because its already generated. After that though, its just the plain old SPA experience.
Django templates are perfectly fine as long as you leverage template tags the way they were intended.
Of course there's many ways around this, but doing them in a declarative, type-safe way is not trivial when using Django templates.
Or is it an apples to oranges comparison?
This does make testing a lot easier, as the server response is identical to the hydrated client.
For React, SSR is secondary. For HTMX, it is primary.
Personally I find JSX to be a terrific templating system, much better than anything like Django's, but if you're familiar with both and prefer Django's, this benefit does not apply to you!