-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
  • 204,283
  • 31
  • 260
  • 272
Alexei
  • 277
  • 1
  • 2
  • 9

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
  • 1,010
  • 9
  • 19