Skip to content

Comment on Principles are products of practice, not the reverseparent

Comments

Thanks, I really didn’t get what they meant with the example they were using.

Out of curiosity why is writing everything as a single element type more ergonomic? I’ve not done frontend web dev in a while and using <p> <h1> and so on seems like it would be more ergonomic to express intent.

The reason why it's so tempting to just use `<div>` everywhere is that `<div>` elements have very simple and predictable behaviour with regards to styling, composition and event handling.

Same cannot be said for a lot of other HTML elements, which often have bizarre and inconvenient rules when it comes to style-ability, or nest-ability.

AboutSource Built by g1lg1l

Hackerly is an independent reader for Hacker News, built on the public HN API. Not affiliated with Y Combinator.