Don’t snark on people who are learning
I saw a post on mastodon snarking at “the current state of web development” and it was a screenshot of a forum where someone was asking why nested <h1>
s got progressively bigger, with a code sample that looked like this:
export default function Home() {
return (
<>
<h1>
test
<h1>test2
<h1>test3</h1>
</h1>
</h1>
</>
)
}
There’s two things going on here: nesting headings is not allowed, as per the spec. Only phrasing content is allowed; not heading content, which a heading falls under.
The second point is that the user agent styles (styles that a browser ships with) will size headings using em
units. An em
unit is a relative unit that is a ratio of its parent’s size. For example, say the computed size of a heading’s text was 30px
and the child element had a font-size
of 2em
, it would be computed as 60px
. This is why the user’s headings kept growing and growing, because each nested item was adding to the ratio each time.
See, that wasn’t hard was it? Straightforward, explanations.
I get the feeling that when folks see some JSX, like the code example above, they presume that the person writing the code is “learning in the wrong way”. There is no right way to learn. There never has been.
Everyone comes into development from different backgrounds, skill-levels and technologies. Some will learn HTML first, which yes, is ideal, but since when was anything in the real world ideal? Development is a very sought-after skill, so naturally, bootcamps will train users to match industry demand: AKA, JavaScript frameworks.
The point I’m making is instead of getting your snark on, help people learn instead. I’m extra sensitive to this because I’m training someone up at the moment, and damn, we take for granted a lot of “expected” knowledge and appreciation of the “right way” that straight-up doesn’t exist for a beginner.
Remember your roots, essentially.
👋 Hello, I’m Andy and this is my little home on the web.
I’m the founder of Set Studio, a creative agency that specialises in building stunning websites that work for everyone and Piccalilli, a publication that will level you up as a front-end developer.
Back to blog