title: get parameter value from url using React Router
body: <p>I want to get the id value from this React Router:</p>
  
  <pre><code>&lt;BrowserRouter basename="/api"&gt;
      &lt;Switch&gt;
          &lt;Route path="/pm" exact component={PaymentMethod}/&gt;
          &lt;Route path="/pw" exact component={PaymentWeb}/&gt;
          &lt;Route path="/rg" exact component={Registrasi}/&gt;
          &lt;Route path="/bonus/:id" exact component={BonusScreen}/&gt;
          &lt;Route path="/hb" exact component={HistoryBonus}/&gt;
      &lt;/Switch&gt;
  &lt;/BrowserRouter&gt;
  </code></pre>
  
  <p>in my <code>BonusScreen</code> I tried to print the value by using this :</p>
  
  <pre><code>const userId = this.props.match.id;
  console.log(this.userId);
  </code></pre>
  
  <p>from the browser I try to access the URL like this:</p>
  
  <pre><code>bonus/NGO628567652201
  </code></pre>
  
  <p>But it always returned <code>undefined</code>.
  <br>How can I fix this ?</p>