A
A
Artur Kudashev2019-05-24 20:53:39
React
Artur Kudashev, 2019-05-24 20:53:39

Why is the element missing?

Hello, there is a list with elements, to which one more element has been added with the help of appenChild. When the state changes, the list is redrawn, but the element remains. If the element was added using js, then it still remains in the dom?

Answer the question

In order to leave comments, you need to log in

1 answer(s)
R
Robur, 2019-05-24
@archi_kud

React is not aware of what else you are adding to the dom.
You can give the entire list a key and change that key so that the entire list node is deleted and recreated - then the left element disappears.
But in general, it’s better not to add anything bypassing the react

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question