I need to insert a JS-script into the React class component and make the script run only at the moment when this component is already mounted and is physically in the DOM. How should I do it? Thank you for attention.
Asked
Active
Viewed 356 times
1 Answers
1
If you need to execute a script or a function once your component is already mounted you should add a componentDidMount in your React class component.
componentDidMount(){}

Girgetto
- 1,010
- 9
- 19
-
And what to write in it? – Alexei Mar 23 '21 at 16:09
-
@Konstantin the JS-script you need – Girgetto Mar 23 '21 at 16:10