horizon-ui/horizon-ui-chakra

remove # from route

dinxsh opened this issue · 2 comments

image

how do I remove the # from the route (like displayed in above image) such that it's http://localhost:3000/auth/default

To remove the "#" from the route in your React application, you can use the BrowserRouter component provided by the React Router library.

Here's an example of how you can use it:

  1. First, make sure that you have installed React Router in your project by running the following command:

    npm install react-router-dom
    
  2. Import the BrowserRouter component in your main app component:

    import { BrowserRouter } from 'react-router-dom';
  3. Wrap your entire application inside the BrowserRouter component:

    import { BrowserRouter } from 'react-router-dom';
    
    function App() {
      return (
        <BrowserRouter>
          {/* your app content goes here */}
        </BrowserRouter>
      );
    }
    
    export default App;
  4. Use the Link component from React Router to create links to other pages in your application:

    import { Link } from 'react-router-dom';
    
    function MyComponent() {
      return (
        <Link to="/auth/default">Go to default page</Link>
      );
    }

    When the link is clicked, the URL in the browser address bar will change to http://localhost:3000/auth/default.

With these steps, you should now have a React application with clean, readable URLs without the "#" symbol.

@Bravco have these on nearly all of them (in layouts folder). yet # is a route!

<Switch>
                {getRoutes(routes)}
                <Redirect from='/' to='/admin/default' />
</Switch>