This is not putting HTML into JS code. This is not HTML! It’s just XML syntax extension for creating new JS function instances. This is JS in JS code but with syntax that looks simular to HTML so this makes it easier for developers who know HTML.
const foo = <Bar></Bar>;
const foo = new Bar();