title: Hello, how can I display a real time clock in React?
body: <p>I followed a certain Youtube tutorial on this subject, and I came up with this code. The time, which is based off the state (dateClass), and the this.time variable. The time displays in the proper area just fine. This test code shows "PM" twice since I wanted to see if the seconds were updating. As you'll see, they're not. I tried to write setTime with the equals sign or with just a parentheses. Either way, the time isn't updating. Pretty weird, since I copied and pasted what the other person did.</p>
  
  <pre><code>constructor(props) {
   super(props);
  
    this.state = {dateClass: new Date()}
    this.time = this.state.dateClass.toLocaleTimeString();
  
        this.hourMin = this.time.length == 10?
        this.time.slice(0):this.time.slice(0,5);
  
        this.diem = this.time.length == 10?
        this.time.slice(7):this.time.slice(8);    
     }
  
     setTime = () =&gt; {
        this.setState({
           dateClass: new Date()
        })
     }
  
     componentWillMount() {
        setInterval(() =&gt; this.setTime, 1000)
      }
  </code></pre>
  
  <p>Here's the render.</p>
  
  <pre><code>render() {
    return(
       &lt;div className="base-content"&gt;
          &lt;div className="close-button" onClick={this.props.close}&gt;&lt;/div&gt;
          &lt;div className="text"&gt;
             &lt;p&gt;The game's phone can bring out some game changing features, even though actually using the phone can get you killed. This is because the Phone's features might take too long to access. In the meantime, other players are taking aim at you. Some of the issues with the phone include too many
             submenu items (Contacts), the fact that it can (and will) interrupt what you're doing, and "pre-scripted load times" as the phone calls someone.
             As you click back and forth from the apps to the phone's Home button, you'll see that I propose very straightforward options to enhance &amp; simplify the game's
             phone.
             &lt;br /&gt;
             &lt;br /&gt;
             For example, if you need to find a set of players to play with, you can deal with the randomness of online matchmaking where players often have
             all types of motives. You can also be more specific with the exact challenge and money details, but you have to go on reddit or another site to do that.
             Considering that the game is already online, why isn't there a Find a Crew app that allows you to find people within specific contexts.
             &lt;br /&gt;
             &lt;em&gt;(P.S. The home button on the phone is clickable)&lt;/em&gt;
             &lt;/p&gt;
          &lt;/div&gt;
  
          &lt;section className="screen"&gt;
             &lt;img src={phone} alt="" className="phone-svg"/&gt;
             &lt;img src={loading} alt="" className="app" /&gt;
             &lt;div className="row0"&gt;
                &lt;img src={batt} alt="" className="icon1" /&gt;
                &lt;img src={wifi} alt="" className="icon2" /&gt;
                &lt;p className="clock"&gt;{
                   this.hourMin + this.diem
                }&lt;/p&gt;
                &lt;p className="day"&gt;Mon&lt;/p&gt;
             &lt;/div&gt;
  
             &lt;div className="row1"&gt;
                &lt;img src={job} alt="" id="job" /&gt;
                &lt;img src={find} alt="" id="find" /&gt;
                &lt;img src={www} alt="" id="www" /&gt;
             &lt;/div&gt;
             &lt;div className="row2"&gt;
                &lt;img src={serv} alt="" id="serv" /&gt;
                &lt;img src={biker} alt="" id="bikers" /&gt;
                &lt;img src={merry} alt="" id="merry" /&gt;
             &lt;/div&gt;
             &lt;div className="row3"&gt;
                &lt;img src={peg} alt="" id="peg" /&gt;
                &lt;img src={lamar} alt="" id="lamar" /&gt;
                &lt;img src={lester} alt="" id="lester" /&gt;
             &lt;/div&gt;
             &lt;span id="close"&gt;&lt;/span&gt;
          &lt;/section&gt;
       &lt;/div&gt;
    )
  </code></pre>
  
  <p>}</p>