-3

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.

j08691
  • 197,815
  • 30
  • 248
  • 265
Alexei
  • 159
  • 5

1 Answers1

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
  • 982
  • 7
  • 17