You really don't need all that JavaScript, I promise

JavaScript is your behaviour layer

JavaScript is your behaviour layer; the way to add interactivity to your sites, to provide a slick and delightful user experience, to make everything fast and easy and clean. But at some point everything changed: the tail started to wag the dog instead and development became Javascript-first. We'll talk about how you maybe shouldn't rely on JS as much as you're told to, and some practical strategies for how to build sites without reaching for a JS framework as first, last, and only tool for making the web happen.

Performance

Quite a lot of people have talked today about performance; you've heard stuff from Phil, from Noam, heard stuff from Alex first thing this morning, so you've already heard what happens if you don't care about performance. What happens is you make Alex sad.

There are other reasons to care about performance, so let's talk about Zach Leatherman. He tested building a client-side React site displaying a tweet, against a plain HTML file displaying a tweet, to time them and see what difference there was.

Let's let Zach speak for himself: which has a better first meaningful paint time? Raw HTML, or a client-rendered React site with one tweet on it, and the answer is: the 8.5MB of HTML renders faster by 200 milliseconds. Don't serve people 8.5MB of HTML; don't do that.

Availability

Have people heard of GDS? The UK's government digital service? They discovered that 1.1% of people hitting their sites weren't getting the JavaScript enhancements. You think: well, OK, 1%, but maybe that's just the way it's got to be.

It's not like this. It's not one person who doesn't get your JavaScript, and 99 people who are all fine. The proportion of people that have explicitly disabled JavaScript only make up a small slice of the people who don't run it. The person not getting all the JavaScript you're serving to them is not just some incredibly ancient not-really-a-smartphone in another country with hardly any connection or anything. It's your actual customers, who will find that your stuff just doesn't work sometimes.

The modern web is difficult

The world that we're building is really bloody hard, and I wish it wasn't. Everyone seems to feel overwhelmed by the choices we have as modern developers. Drew McLellan says, "Increasingly there seems to be a sense of fatigue within our industry. Just when you think you've got a handle on whatever the latest technology is, something new comes out to replace it."

Can you keep up with all this stuff? I can't keep up with all this stuff.

Why are we doing all of this?

There are good reasons why this stuff is important. You've got things like component reuse and following best practices, which are all good. But I think we didn't say: we want all of those things, so let's build frameworks. I think we said: we've built frameworks, now justify why they're a good idea.

Holding control

The reason people started inventing client-side frameworks is this: that you lose control when you load another page. Instead of letting the browser handle navigation, I will handle navigation, so as to avoid the loss of control.

Control without implementing loading yourself

This is what <portal> is for. Basically a portal is an iframe, but you can tell the browser: make the thing in this iframe be the main page. The key point about this is that the URL changes too.

You can create a portal element, and it loads in the bottom corner, and then activate it. You've still got control. So you can do whatever you want in that gap, such as animate it.

The key point here is: it's all built one step on top of another, dependent on the previous. But if you can control page loading without having to implement loading yourself, that solves actual problems.

Conclusion

Don't fight against the web, and the things that browsers are doing well. If you want to fight, fight that. Web frameworks are a great thing to prototype stuff; but are you honestly on the bleeding edge at all times?

It's valuable what we do, as an industry. We have the power to connect people together, and I want to keep it that way. That's what I think is important about the web.