Search code examples
reactjsreact-routeradmin-on-restreact-admin

How to use pretty URLs (BrowserRouter) with react-admin


Is there a way to use BrowserRouter with react-admin to have URLs without the # character?


Solution

  • You'll have to supply your own history. See https://marmelab.com/react-admin/Admin.html#history

    import createHistory from 'history/createBrowserHistory';
    
    const history = createHistory();
    
    const App = () => (
        <Admin history={history}>
            ...
        </Admin>
    );