title: Typescript - Left side of comma operator is unused and has no side effects - How to use constants in place of strings in hookrouter's route?
body: <pre><code>import React from "react";
  import Users from "./components/Users";
  import Contact from "./components/Contact";
  import About from "./components/About";
  const routes = {
    "/": () =&gt; &lt;Users /&gt;,
    "/about": () =&gt; &lt;About /&gt;,
    "/contact": () =&gt; &lt;Contact /&gt;
  };
  export default routes;
  </code></pre>
  
  <p>May I know how to use constants instead of strings in the routes as follows please?</p>
  
  <pre><code>const root = "/";
  
  const routes = {
    `${root}`: () =&gt; &lt;Users /&gt;,
  };
  </code></pre>
  
  <p>When I tried the code above, I got the following error:</p>
  
  <pre><code>Left side of comma operator is unused and has no side effects
  </code></pre>