4 ms·
I wrote something similar by myself for a PHP CMS project with server side templating. My use case was progressive enhancement for pagination and filtering for
by moritzwarhier 3y ago
I wrote something similar by myself for a PHP CMS project with server side templating.
My use case was progressive enhancement for pagination and filtering for lists, preserving all functionality with JS turned off, and using shareable "isomorphic" URLs.
It worked out pretty well, my headaches mostly stemmed from the backend and the "isomorphic" part: slight tendencies towarda overengineering and hard-to-fix bugs all stemmed from the backend ("ajax vs non-ajax", simply put).
Cool URIs don't change.
My two cents:
1. If there is a solution tailored to your backend, use it (unless it involves complex DSLs or many dependencies)
2. If not, write the code by yourself. It's not actually hard, most work is in the backend. Use "pushState" instead of "replaceState" only after everything is proved to work. Only push URLs, no data.
This is simple, low-hanging 2006ish JS. Don't use backend-agnostic cruft for this. It'll waste time.
It you need complex client-side interactivity as well as SSR and/or SSG, use a full-stack TS solution or an SPA with SSR.