title: How to access props.match.params in functional components
body: <p>I am trying to access the handle ID which is set up on my App.js like this:</p>
  <pre><code>          &lt;Router&gt;
              &lt;Switch&gt;
                &lt;Route exact path='/users/:handle' component={User}/&gt;
              &lt;/Switch&gt;
             &lt;/Router&gt;
  </code></pre>
  <p>I want to access it in my User component, but am getting the error &quot;Cannot read property 'match' of undefined&quot;. How do you access the match params in a functional component?</p>
  <pre><code>const User = (props) =&gt; {
  
  useEffect(() =&gt; {
    getProfile();
  })
  
  const getProfile = (props) =&gt; {
      const { handle } = props.match.params.handle;
      const { postId } = props.match.params.postId;
  
      if (postId) setPostIdParam(postId);
  
      props.getUserData(handle);
      axios.get(`/user/${handle}`)
        .then((res) =&gt; {
          setProfile(res.data.user);
        })
        .catch((err) =&gt; console.log(err));
  }
  </code></pre>