title: Type or interface for location.state in react-router
body: <p>In one component, there is a <code>&lt;Link&gt;</code> (from react-router-dom) passing an object in the state property.</p>
  
  <p>Another component called <code>ReceiverComponent</code> is receiving that object correctly. However, the code belows complains with the message:</p>
  
  <blockquote>
    <p>Type 'PoorMansUnknown' is not assignable to type 'locationStateProps'.
    Type 'undefined' is not assignable to type
    'locationStateProps'.ts(2322)</p>
  </blockquote>
  
  <pre><code>type locationStateProps = {
    name: string;
  }
  
  function ReceiverComponent() {
    const location = useLocation();
    const myState: locationStateProps = location.state;
    return (
      &lt;div&gt;
        {myState.name}
      &lt;/div&gt;
    );
  }
  </code></pre>
  
  <p>I need to provide a type for the state some way without this error. How to proceed?</p>