Remount componentDidMount() by path.name

前端 未结 4 1480
野性不改
野性不改 2021-01-25 23:11

When the page loads I use componentDidMount() to document.createElement(\"script\"); in the layout index.js of a ReactJS and G

4条回答
  •  北海茫月
    2021-01-26 00:05

    componentDidMount runs the first time (and only the first time!) the component is mounted in the DOM.

    componentDidUpdate runs every time the component receives new props, but not for the initial render.

    In order to operate on the DOM for the first render and for subsequent updates, you'll need to register your

提交回复
热议问题