I
I
Ignatiy22019-08-07 11:24:47
JavaScript
Ignatiy2, 2019-08-07 11:24:47

How to manually insert DOM components in a react tree?

I have a task to manually insert a component into the DOM tree. That is, by analogy with

let container = document.getElementById('container');
let h2 = document.createElement("h2");
h2.innerHTML = "Hello!";
container.appendChild(h2);

But I need to insert my own Title component instead of h2. How can this problem be solved? (return won't work in my case)

Answer the question

In order to leave comments, you need to log in

1 answer(s)
A
Anton Spirin, 2019-08-07
@Ignatiy2

Portals

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question