import React from "react";
import Users from "./components/Users";
import Contact from "./components/Contact";
import About from "./components/About";
const routes = {
"/": () => <Users />,
"/about": () => <About />,
"/contact": () => <Contact />
};
export default routes;
May I know how to use constants instead of strings in the routes as follows please?
const root = "/";
const routes = {
`${root}`: () => <Users />,
};
When I tried the code above, I got the following error:
Left side of comma operator is unused and has no side effects
() => (<Users />),
. – Triangular${root}`: () => (<Users />),
Still I get the same error – Seem