V
V
Vanya Huk2018-08-12 05:48:00
React
Vanya Huk, 2018-08-12 05:48:00

Why does document.getElementById return null in react?

Why does document.getEelementById return null in react even though it works when called from console?

Answer the question

In order to leave comments, you need to log in

1 answer(s)
A
Alexey Ukolov, 2018-08-12
@alexey-m-ukolov

Because the moment you call this method inside react, your component has not yet been mounted or rendered. React doesn't intentionally break standard methods to make it harder for you to work. Show your code and we can explain to you what exactly you are doing wrong.

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question