Skip to navigation Skip to content
Simon Technology Blog
  • Architecture
  • Cloud
  • Database
  • Develop
  • Hardware
  • Industry
  • Language
  • Mobile
  • Opensource
  • OS
  • Web
Main Navigation

How to use ReactJS from the login page to the dashboard

October 21, 2021By Simo React

This is my login page (App.jsx) I am trying to navigate to the dashboard after a successful login. But it is not navigating as expected. I want to know if it is possible from an external page ( App.jsx) Navigate to the routing page (Dashboard.jsx).

import React from'react';
import createHistory from'history/createBrowserHistory' ;

const history = createHistory();

export default class App extends React.Component {

constructor(props){
super(props);
this.state = {}
}

goToDashboard(e){
this.props.history.push('/employeelist') ;
}

render() {
return (





< /div>






);
}
}

App.contextTypes = {
router: React.PropTypes.object.isRequired
}

This is my dashboard page (Dashboard .jsx)

import React from'react';
import App from'./App.jsx';
import EmployeeRegister from'./EmployeeRegister .jsx';
import EmployeeList from'./EmployeeList.jsx';
import {HashRouter, Route, Link} from'react-router-dom';

export default class Dashboard extends React.Component{

render(){

return(
(






Employee


  • Form


  • Master Files

    • CreateEmployee



  • Show Employees< /li>











)
);

}

};

I include all content in higher-level components (App), And routing inside the App component. In this way, you can more easily build the path and swap out the children as needed.

More or less like this;




This is my login page (App.jsx). I am trying to navigate to the dashboard after a successful login. But it is not navigating as expected. I want to know if it is possible to navigate from an external page (App.jsx) to the routing page (Dashboard. jsx).

import React from'react';
import createHistory from'history/createBrowserHistory';

const history = createHistory();

export default class App extends React.Component {

constructor(props){
super(props);
this.state = {}
}

goToDashboard(e){
this.props.history.push('/employeelist');
}

render() {
return (




< br />






);
}
}

App.contextTypes = {
router: React.PropTypes.object.isRequired
}

This is my dashboard page (Dashboard.jsx)

import React from'react';
import App from './App.jsx';
import EmployeeRegister from'./EmployeeRegister.jsx';
import EmployeeList from'./EmployeeList.jsx';
import {HashRouter, Route, Link} from'react-router-dom';

export default class Dashboard extends React.Component{

render(){

return(
(






Employee


  • Form


  • Master Files

    • CreateEmployee



    • Show Employees












)
);

}

};

I will include everything higher In the lower-level component (App), and routed inside the App component. In this way, you can more easily build paths and swap out subitems as needed.

More or less This way;




dashboard, how to use, login, Navigation, page, Reactjs

Post navigation

What is the best way to build an XML document in .NET?
XML – JAXB and XLINK – Friends or enemies?

WordPress database error: [Table 'yf99682.wp_s6mz6tyggq_comments' doesn't exist]
SELECT SQL_CALC_FOUND_ROWS wp_s6mz6tyggq_comments.comment_ID FROM wp_s6mz6tyggq_comments WHERE ( comment_approved = '1' ) AND comment_post_ID = 5984 ORDER BY wp_s6mz6tyggq_comments.comment_date_gmt ASC, wp_s6mz6tyggq_comments.comment_ID ASC

Leave a Comment Cancel reply

Your email address will not be published.

Recent Posts
  • Sencha-Touch-2 – Sencha Touch 2, Nested XML Analysis NodeValue
  • Add a separation line and format XML content
  • Is there a norm of simplified XML subsets?
  • Look at it when you write React
  • ReactJS – Present React Redux React-Router App to add the server to the Firebase hosted by the Firebase
Categories
  • Android
  • Apache
  • Apache Kafka
  • Asp
  • Auto-Test
  • Automated Build
  • Aws
  • Bitcoin
  • Browser
  • C & C++
  • C#
  • Centos
  • Cgi
  • Character
  • Cloud Service
  • Cocos2dx
  • Cordova
  • CSS
  • Data Structure
  • Delphi
  • Design Pattern
  • Dojo
  • Dubbo
  • ELK
  • Flex
  • football
  • Game
  • Hadoop
  • Hibernate
  • HTML
  • Hybrid
  • Intel
  • IOS
  • Ipad
  • iPhone
  • Java
  • Javascript
  • Jetty
  • JQuery
  • Jsp
  • Linux
  • Load Balance
  • Lua
  • Macbook
  • Macos
  • Mathematics
  • Micro Services
  • Monitoring
  • Motherboard
  • Mysql
  • Network Hardware
  • Network Marketing
  • Nginx
  • NodeJs
  • Nosql
  • Oracle
  • Os Theory
  • Performance
  • PHP
  • Postgresql
  • Power Designer
  • React
  • Redis
  • Regexp
  • Rom
  • Rss
  • Ruby
  • Search Engines
  • Shell Script
  • Silicon Valley
  • Silverlight
  • Software Design
  • Spring
  • Sql
  • Sqlite
  • Sqlserver
  • Storage
  • Storm
  • Surface
  • SVN
  • Swift
  • System Architecture
  • Tablet
  • Uncategorized
  • Unix
  • Visual Basic
  • Visual Studio
  • Web Crawler
  • WebService
  • Windows
  • Wireless
  • XML
  • ZooKeeper
Archives
  • October 2021
  • September 2021
  • August 2021
  • May 2021
  • April 2021
  • September 2020
  • September 2019
  • August 2019
  • June 2019
  • May 2019
  • April 2019
  • March 2019
© Simon Technology Blog 2025 • ThemeCountry Powered by WordPress