Get the latest tech news

JavaScript Views, the Hard Way – A Pattern for Writing UI


JavaScript views; done as painfully as possible. Contribute to matthewp/views-the-hard-way development by creating an account on GitHub.

If the component you are working on is likely to be used multiple times in an application (such as a list item) you should probably not use ids, but rather a class name or possibly a data attribute. It contains variables and functions that are used to change state, modify the DOM, listen to events, and receive updates from parent views. One of the difficulties in writing low-level imperative views is keeping track of where DOM mutations can occur.

Get the Android app

Or read this on Hacker News

Read more on:

Photo of pattern

pattern

Photo of hard way

hard way

Photo of javascript views

javascript views

Related news:

News photo

‘Gradually then suddenly’: Is AI job displacement following this pattern?

News photo

Kerning, the Hard Way

News photo

Elon Musk’s X engaged in a ‘pattern of election interference' to help Trump