When to use the id attributeThe id attribute is arguably one of the most popular attributes used in HTML, second only to the class attribute. It serves a lot of purposes, which means it can easily be misunderstood or misused. Let's take a look at what it's really for, what it's...Feb 15, 2023 · 8 min readwebdev.tips
What state should be stored in the URLThe URL can be a powerful tool for sharing and managing the state of an app, but it's often overlooked or misunderstood. When properly done, the typical CRUD app with read/write/edit/delete functionality doesn't need much more state management than t...Feb 14, 2023 · 5 min readwebdev.tips
How to sort arrays reliably in TypeScriptLet's say you have an array of numbers and need to sort them; it's easy to just call .sort() and be on your way, like this: const numbers = [10, 25, 2, 4, 1, 100, 6] numbers.sort() You would probably assume that since the values are numbers, it wou...Feb 13, 2023 · 4 min readwebdev.tips
How to render a form with an external submit buttonThere should be at least two ways for any user to submit a form. Pointer users should be able to press a submit button, and keyboard users should be able to press the enter key. Both of these UX behaviors are provided natively by the browser, given a...Feb 9, 2023 · 2 min readwebdev.tips
Styling using data attributesThe vast majority of design systems and component libraries organize their styles using class selectors. Generally, this is a good choice, but it's not perfect. Methodologies like BEM are used as a way to organize these classes into component and mod...Feb 8, 2023 · 3 min readwebdev.tips