title: How do I search using an id , but use a slug in the url link in React
body: <p>I am getting my posts in React using a fetch to my Rails API. In this information, I'm getting a primary key, and a slug (which I would like to use for the URL). </p>
  
  <p>This is an example API call in Post.js</p>
  
  <pre><code>axios
      .get(`/api/posts/${params.postId}`
  </code></pre>
  
  <p>For example for a post id of 1 and a slug that is (this-is-a-slug).
  I would like to be able to search using the id and have the URL be </p>
  
  <p>/post/this-is-a-slug instead of post/1</p>
  
  <p>This is the current route in Routes.js</p>
  
  <pre><code>      &lt;Route path={"/post/:postId"} exact strict component={PostShow} /&gt;
  </code></pre>
  
  <p>I know using Primary Id's are faster than using strings to search, so it'd be nice if I could search with the id's but show the slugs in the title.</p>
  
  <p>What do I need to do to get this to work? Do I need to create a slug model with a slug id, and then reference to the post id. I'm just a little confused. Thanks for helping me out!</p>