title: Display clock in react.js
body: <p>I am a beginner in react.js. I wanted to display the clock on my web application, but unfortunately my clock is fixed and does not move forward. What can I do to change the react like this link for a moment, thank you for your help
  <a href="https://www.w3schools.com/js/tryit.asp?filename=tryjs_setinterval2" rel="nofollow noreferrer">https://www.w3schools.com/js/tryit.asp?filename=tryjs_setinterval2</a></p>
  <pre><code>    const setTime = setInterval(time, 1000);
      const event = new Date();
      const time = () =&gt; {
          return event.toLocaleTimeString('fa-IR');
      };
  </code></pre>