Could someone simplify (5th grade level) how <templates> work?

Some questions:

I know they contain HTML content hidden from the user when the page is loaded but what would be an example of something you would add to a <template> ?

I see it helps if you have code you want to use over and over again but what may that content be?

Why would you render template to JavaScript?

Lastly, here’s a paragraph out of a book I’m reading:

r/webdev - Beginners level <template> explanation.

It says to change the presentation of something in the template, and it will automatically update every page that uses that template. My confusion is that previously it stated <templates> contain hidden information. But the word “presentation” in this paragraph doesn’t sound like it would be hidden to user.



Source link

Write A Comment