▲ | anaisbetts 2 days ago | |||||||
Of course, the goal of the example is to teach using an example that makes sense logically. Templates can be arbitrarily large and obviously as the template gets bigger, the difference between it and manual `document.createElement` calls gets much larger. | ||||||||
▲ | rendaw 2 days ago | parent [-] | |||||||
The difference in what? TBH I don't get the purpose either. You have to use javascript either way, and it's trivial to do make a shorthand for `document.createElement` that sets properties and adds children... maybe 10 lines per project. I thought it was an optimization, but benchmarking `document.createElement` was significantly faster (firefox). And then having `template` in your html means that changes to the template/use are less local. I feel like this is an improvement that only makes sense if you're neck deep in the react world. | ||||||||
|