title: If don't send any id an URL how to handle that error in react js
body: <p>Let's say I have hit a URL and by mistake, I forgot to send the id. how to handle it?</p>
  <p>here is the sample code
  App.js</p>
  <pre><code>import Filter from './component/Filter';
  import { Route } from &quot;react-router-dom&quot;;
  
  function App() {
    return (
      &lt;div className=&quot;App&quot;&gt;
        &lt;header className=&quot;App-header&quot;&gt;
          &lt;Filter /&gt;
          &lt;Route path=&quot;/searchById/:id&quot; exact component={Filter} /&gt;
        &lt;/header&gt;
      &lt;/div&gt;
    );
  }
  
  export default App;
  </code></pre>
  <p><a href="https://i.stack.imgur.com/10qTL.png" rel="nofollow noreferrer">refer this image</a></p>
  <p>when I send some id it's working fine. But if I don't give any id I want to display some error message like id must be mandatory.</p>