React router-dom isn’t working and ı need to test admin log

I’m a starter on react.js . I have a problem. When ı put the Layout component, link and other roots isn’t working. I have a admin page and ı need to test user. How can ı solve that problem. And I don’t know whether I should use the layout component or not. Pls help
(I need to test the user is admin. if he enter …/admin we need to test him)

**LAYOUT.JSX**
const isAdmin = window.location.pathname.startsWith("/zupizu");
export const Layout = isAdmin ? Adminpage : Mainpage 

**MAİN.JSX**
ReactDOM.createRoot(document.getElementById("root")).render(
  <BrowserRouter>
  <Layout>
    <App />
  </Layout>
  </BrowserRouter>
);