react function is called once every 2 seconds

Source:

  componentDidMount() {

    // life hooks, assembly is hung after the call

    this.func ();

  }

func = () => {

    setInterval(() => {

     alert ( "every 2 seconds calls a function");

    }, 2000);

  }

Published 98 original articles · won praise 19 · Views 100,000 +

Guess you like

Origin blog.csdn.net/water_Popcorn/article/details/103251779