reactjsreact-routerfrontendreact-router-domreactify

How to integrate dashboard on exsiting app with ReactJS?


I have a dashboard Reactify and I want to integrate it into my reactjs app with create-react-app.

I want to redirect to the dashboard from my application with the route /admin.

How can I fix that ?


Solution

  • First of all i hope you are using 'react-router-dom' package for routing. if yes, you can import your dashboard component and use it inside the Router tag to route to the dashboard.

    for example:

    import Dashboard from './components/Dashboard.js'; //give proper path to dashboard      component
    //then inside render in your app
    render() {
    return (
    <Router>
    <Route path="/admin" component={Dashboard} />
    </Router>"    
    );
    }
    

    to learn the basics, checkout the documentation for react-router-dom

    Hope this would be helpful!