JavaScript Views, the Hard Way – A Pattern for Writing UI
Published on: 2025-04-19 12:10:52
Writing JavaScript Views the Hard Way
Learn how to build views in plain JavaScript in a way that is maintainable, performant, and fun. Writing JavaScript Views the Hard Way is inspired by such books as Learn C the Hard Way.
What is this?
Writing JavaScript Views the Hard Way is a pattern for writing JavaScript views. It is meant to serve as an alternative to using frameworks and libraries such as React, Vue and lit-html.
It is a pattern, not a library. This document explains how to write views in such a way as to avoid the spaghetti code problems that commonly occur when writing low-level imperative code.
We call this technique the hard way because it askews abstractions in favor of directness.
Advantages over frameworks
There are several reasons why you might be interested in writing your views the hard way:
Performance : Writing JavaScript Views the Hard Way uses direct imperative code, so there are no unnecessary operations performed. Whether a hot or cold path, using this t
... Read full article.