Skip to content

React Router Dom #40

Answered by codesbiome
CTExhb asked this question in Q&A
Discussion options

You must be logged in to vote

React routes can be used with Electron as we use them in typical web applications based on React/Vue etc.
Just define the routes in Application component and navigate between route's components using the MemoryRouter from react-router-dom.

import React, { Component } from 'react';
import { MemoryRouter as Router, Route, Link, Switch } from 'react-router-dom';
import Home from './component/home';
import About from './component/about';
import Contact from './component/contact';
import './App.css';
  
class App extends Component {
  render() {
      return (
        <Router>
            <div className="App">
                  <Link to="/">Home</Link>
                  <Link to="/about">About Us

Replies: 2 comments

Comment options

You must be logged in to vote
0 replies
Answer selected by CTExhb
Comment options

You must be logged in to vote
0 replies
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Category
Q&A
Labels
None yet
2 participants