Hi friends,
Still trying to figure out what to do with this newsletter. All I know is that it is fun to write, but I don’t know how I should write it in a way that is interesting for others.
Anyway. Here are some updates from the last few weeks:
—
/Dev
One short explanation of a commonly mentioned Dev concept.
This time, SPAs explained:
The traditional way of rendering web pages is to render all the HTML on the server and send the finished HTML page to the client browser.
Single-Page Applications (SPAs) renders the HTML on the client side through JavaScript. All it gets from the server is a single empty HTML shell.
The empty HTML shell is then filled by using JavaScript.
Modern JavaScript frameworks like React and Vue works as SPAs.
Why?
Since all the websites pages are stored as JavaScript data, you don’t have to make new requests to the server every time you browse to a new page. The SPA simply loads the new page directly from its internal data. This reduces load time and bandwidth.
SPAs makes it easier to add “reactivity” across a website, since the data can be known across the whole app without having to go to the server as a middleman.
For these reasons, SPAs are typically said to have better user experience.
Why not?
Since the webpage is rendered on the client side, it is empty when it is visited by google’s crawlers. So, bad for SEO.
If you want full control of the analytics of a website (what pages are visited most, etc.), this can be harder to do on SPAs, since it is just one page (with different “views”).
But..
Meta-frameworks such as Next or Nuxt add server-side rendering capabilities to React and Vue, respectively. Giving the capabilities to pre-render pages on the server side. This is good for SEO.
Or..
If you don’t need high amounts of reactivity, but just a basic website, then don’t use SPAs. They will just complicate things for you. Instead go for HTML+CSS+jQuery+Backend Framework (Laravel/Flask/Django/etc.)
Vue can also be used similar to jQuery, if importing it with the script tag from a CDN. Then you can add it only to the components of your website that do need interactivity.
Hope that was helpful.
—
Training
Still trying to do the 3x5 thing for one-arm pull ups. Almost did one! Progress is motivating.
—
Have a good week :)
Eric