title: Unable to re-direct to page not found (React Hooks)
body: <p>I have been trying to create a Redirect from my details component to my NotFound component however I keep getting the below TypeError. I assume my if statement is in the wrong place?</p>
  
  <pre><code>Cannot read property 'title' of undefined
     8 | 
     9 | useEffect(() =&gt; {
    10 |   let tvShow = getGallery().find(gallery =&gt; gallery.id === tvShowId);
  &gt; 11 |   setDetailsText(tvShow.title);
       | ^  12 | }, [tvShowId]);
    13 | 
    14 | if(tvShowId === undefined) {
  </code></pre>
  
  <p>Tried to put my if statement before the useEffect hook and also within it.</p>
  
  <pre><code>export default function Details(props) {
  const [detailsText, setDetailsText] = useState();
  const tvShowId = props.match.params.tvShowUrl;
  
    useEffect(() =&gt; {
      let tvShow = getGallery().find(gallery =&gt; gallery.id === tvShowId);
      setDetailsText(tvShow.title);
    }, [tvShowId]);
  
    if(tvShowId === undefined) {
      return &lt;Redirect to = '/NotFound' /&gt;
    } else {
      return (
        &lt;div&gt;
          &lt;h1&gt;{detailsText}&lt;/h1&gt;
          &lt;Link to="/"&gt;Return to Home Page&lt;/Link&gt;
        &lt;/div&gt;
      )
    }
  }
  </code></pre>
  
  <p>I want a Redirect if the wrong URL is input.</p>