by bigmanwalter · 3y ago · 0 comments
These days you can slap together a very capable PHP based Ecom solution using Livewire for those sections that need interactivity.
People really need to realise just how detremental to the user experience it is to have mountains of JS being needed just for an ecommerce site.
Think data analysis tools, Intranet tools, e-commerce, and a host of B2B stuff?
I know, it all starts with a filterable list or a shopping basket, where page reloads or ajax "sprinkles" (regardless of what they're loading, HTML or JSON) are absolutely OK.
Especially the fully old-school approach with the page reloads - it can work and scale for simple and predictable requirements.
Until it doesn't - the first page with 5 interdependent autocomplete inputs takes weeks to develop and fix, the modals can't have routes without piles of jQuery hacks, and so on and ao forth
If a five input form takes week to fix, you have engineering problems beyond any choice of framework…
all the application and interface logic is in the browser. this is only possible thanks to SPA.
It was also the first SPA I made, in a career of decades. I also think I do not regularly use anything that benefits from being an SPA (I don't regularly use that diagram designer either).
It was fun to write. Relevant code is here:
https://github.com/ldyeax/jimm.horse/blob/master/j/j.php
https://github.com/ldyeax/jimm.horse/blob/cb6a1c03504cbe6b63...
I actually uncovered a niche bug across multiple browsers with this PHP code. In at least Firefox and Edge, if a page is cached with a fetch using accept:text/json, the response will be shown from view-source of the html page you have open, even if the content is different when you fetch the page with accept:text/html
The idea is the same code can work on front end and backend. On NextJS it will run your React on the backend but useEffects will not be called. Just the initial render is saved and piped to the browser.
Unless there is a legacy system driving the requirements in a different direction, my default application architecture is always going to be server-side React at this point.
Or maybe hire people who can code in more than one framework.
But it’s not a circle, it’s an arc. If it were a circle, running as fast as you can in one direction would bring you back around to the former. Instead we hit the end of the swing and backpedal until we remember why we were going this direction in the first place.