> I've never seen any added javascript to a page that went as far as generating and rendering other pages completely, that's always been a refresh.
pjax[1] does what you are describing. There are other similar libraries as well. On user navigation, it makes a XHR request to the server, and updates in place any changed DOM elements. I like this, because it progressively enhances the user experience. An application should focus on serving content quickly to the user, then improving the experience where browsers leave a gap. Notice that pjax provides the same functionality as an isomorphic javascript without inflicting upon the world server side javascript ;)
I just remembered this gem from the react community! react-magic [1] intercepts navigation and form submission, makes a XHR request, parses the response into JSX, and uses react to update the modified dom elements. I just tested it out on one of my projects, and it had a few issues. I wish this were production ready, because it seems like a very easy way to enhance a traditional server side rendering application.
Ah, I stand corrected! I've never seen pjax before.
That said, this project was created in February 2015... It's not that the "Traditional server-rendered pages" approach had been doing this for decades and isomorophic javascript simply reinvented the wheel here... this is a new project.
I shouldn't have claimed that you need full javascript to do this, that was clearly wrong, but my point is that isomorophic javascript is not the same as the common traditional server-rendered pages used before javascript single page applications came around.
Ideally there should be a way to render JavaScript on the server side for views/templates, like React, without having to write your whole backend in JS. In fact I just googled and found something like this in the reactjs commmunity repo: https://github.com/reactjs/react-php-v8js
One easy solution is to have a server side application that just serves the view layer. That bit can be JavaScript, then your API can be whatever language you want.
Interesting. I definitely want to experiment with something like that. Most examples I've seen of a WP theme in React (e.g. https://github.com/Automattic/Picard) use the new WP API and a node.js app. So there are (at least) two potential approaches to this.
Yeah, I considered that, and in some cases might take that approach.
But in my particular case the websites need to be server-side for SEO, so it's mostly just that I want to use React for reusability and because I prefer it over wordpress theming with php tags.
Furthermore, I can now use React and still deploy the site on a typical LAMP-stack cheap hosting!
pjax[1] does what you are describing. There are other similar libraries as well. On user navigation, it makes a XHR request to the server, and updates in place any changed DOM elements. I like this, because it progressively enhances the user experience. An application should focus on serving content quickly to the user, then improving the experience where browsers leave a gap. Notice that pjax provides the same functionality as an isomorphic javascript without inflicting upon the world server side javascript ;)
[1] https://github.com/MoOx/pjax