If I try to do document.querySelector
for an element inside the React component inside componentDidMount
, it seems like it does not guarantee it (componentDidMount
) gets called after its on the DOM. The result is it cannot find the element
Is there an event I should used instead if I want to access the DOM? After its attached to the DOM?
As a workaround, I used setTimeout
is there a better way?