title: Cannot read property of number
body: <p>How can I <code>print</code> in <code>setTimeout</code> with this <code>{newOrder.number}</code>?
  I get this error: <code>Cannot read property of number</code></p>
  <p>I know this is an beginner mistake, but i dont know how to handle it.</p>
  <p>This is my code:</p>
  <pre><code>const styles = useStyles();
    const { state, dispatch } = useContext(Store);
    const { order } = state;
    const { loading, error, newOrder } = state.orderCreate;
  
    const print = usePrinter(&quot;192.168.1.254&quot;, &quot;8008&quot;);
  
    useEffect(() =&gt; {
      if (order.orderItems.length &gt; 0) {
        createOrder(dispatch, order);
        setTimeout(() =&gt; {
          console.log(newOrder.number);
      }, 2000);
      }
    }, [order]);
  
  setTimeout(() =&gt; {
          print(newOrder.number);
      }, 2000);
  
  return (
      &lt;Box className={[styles.root, styles.navy]}&gt;
        &lt;Box className={[styles.main, styles.center]}&gt;
          &lt;Box&gt;
            {loading ? (
              &lt;CircularProgress&gt;&lt;/CircularProgress&gt;
            ) : error ? (
              &lt;Alert severity=&quot;error&quot;&gt;{error}&lt;/Alert&gt;
            ) : (
              &lt;&gt;
                &lt;Typography&gt;
                  Your order number is {newOrder.number}
                &lt;/Typography&gt;
              &lt;/&gt;
            )}
          &lt;/Box&gt;
        &lt;/Box&gt;
      &lt;/Box&gt;
    );
  </code></pre>
  <p>Thanks!!!</p>