title: Questions about initializing `useState` with `Date.now()`
body: <p>I am using an API to retrieve latest posts from Firestore. The API is something is like this </p>
  
  <pre class="lang-js prettyprint-override"><code>function loadFeedPosts(
    createdAtMax,
    limit
  ) {
    return db
      .collection("posts")
      .orderBy("createdAt", "desc")
      .where("createdAt", "&lt;", createdAtMax)
      .limit(limit)
      .get()
      .then(getDocsFromSnapshot)
  }
  </code></pre>
  
  <p><code>createdAtMax</code> is the time we need to specify in order to retrieve the posts. </p>
  
  <p>And I have a <code>Feed</code> component. It looks like this.</p>
  
  <pre class="lang-js prettyprint-override"><code>
  
  function Feed() {
    const [posts, setPosts] = useState([])
    const [currentTime, setCurrentTime] = useState(Date.now())
    const [limit, setLimit] = useState(3)
  
    useEffect(() =&gt; {
      loadFeedPosts(currentTime, limit).then(posts =&gt; {
        setPosts(posts)
      })
    }, [currentTime, limit])
  
    return (
      &lt;div className="Feed"&gt;
        &lt;div className="Feed_button_wrapper"&gt;
          &lt;button className="Feed_new_posts_button icon_button"&gt;
            View 3 New Posts
          &lt;/button&gt;
        &lt;/div&gt;
  
        {posts.map(post =&gt; (
          &lt;FeedPost post={post} /&gt;
        ))}
  
        &lt;div className="Feed_button_wrapper"&gt;
          &lt;button
            className="Feed_new_posts_button icon_button"
            onClick={() =&gt; {
              setLimit(limit + 3)
            }}
          &gt;
            View More
          &lt;/button&gt;
        &lt;/div&gt;
      &lt;/div&gt;
    )
  }
  </code></pre>
  
  <p>So when people click on the <code>View More</code> button, it will go retrieve 3 more posts. </p>
  
  <p>My question is, since clicking on the <code>View More</code> button triggers a re-render, I assume the line <code>const [currentTime, setCurrentTime] = useState(Date.now())</code> will get run again, does the <code>Date.now()</code> which serves as the initial value for <code>currentTime</code> get evaluated again for every re-render? </p>
  
  <p>I tested it myself by logging out <code>currentTime</code>, and it seemed <strong>not</strong> updating for every render. According to the React doc <a href="https://reactjs.org/docs/hooks-reference.html#lazy-initial-state" rel="nofollow noreferrer">https://reactjs.org/docs/hooks-reference.html#lazy-initial-state</a>, I thought only when using Lazy initial state, the <code>initialState</code> is only calculated once. But here I am not using Lazy initial state, how come it is not calculated every time the component re-renders?</p>
  
  <p>Although <strong>the intended behavior of the initial state of <code>currentTime</code> is exactly stays the same for every re-render</strong>, I am just baffled why it didn't get re-calculated for every re-render since I am not using Lazy initial state</p>