Business
Jobs
  • About Us
  • Solutions
    • Job Postings
      Post your job and receive qualified candidates in 48h.
    • Candidate Assessments
      500+ technical and psychological tests, plus anti-fraud.
    • Headhunting
      Tailor-made executive search from start to finish.
    • Payroll + EOR
      Payroll dispersal and EOR across 15+ LATAM countries.
  • Pricing
  • Jobs

0

135
Views
React - How to navigate to next popup view using route?

I have tried to find a solution to this problem without success. So I have a popup view and the idea is to navigate to a new view(component) within the popup using route. This is what I have so far:

This is the Popup component that opens when triggered:

import styled from "styled-components";
import { BrowserRouter as Router, Link as LinkR, Switch, Route } from "react-router-dom";

export const NavBtn = styled(LinkR)`
`;

export default function App(props) {

  return (
    <div className="ms-welcome">
      <LogoWrap>
        <LogoBtn>
          <LogoText>Welcome to the first popup view</LogoText>
        </LogoBtn>
      </LogoWrap>
      <hr />
      <Router>
        <Switch>
          <NavBtn to="/PopupSecondView">
            <NavBtnLink>Next window</NavBtnLink>
          </NavBtn>
          <Route path="/PopupSecondView" component={SecondView} />
        </Switch>
      </Router>
    </div>
  );
}

This is my second popup view(component):

export default function SecondView(props) {
  
    return (
      <div >
        <LogoWrap>
          <LogoBtn>
            <LogoText>Welcome to the second view</LogoText>
          </LogoBtn>
        </LogoWrap>
        <hr />
          <NavBtn>
            <NavBtnLink >Previous window</NavBtnLink>
          </NavBtn>
      </div>
    );
  }

This is my App.js which is not located at the root of my project. It is located inside the same folder as the popup component:

export default function App(props) {

  return (
    <div className="ms-welcome">
      <Router>
        <Switch>
          <Route path="/PopupSecondView" component={SecondView} />
        </Switch>
      </Router>
      <LogoWrap>
        <LogoBtn>
          <AiFillHome />
          <LogoText>Virta</LogoText>
        </LogoBtn>
        <LogoBtn>
          <AiOutlineInfoCircle />
          <LogoText>Info</LogoText>
        </LogoBtn>
        <LogoBtn>
          <VscRefresh />
          <LogoText>Update</LogoText>
        </LogoBtn>
      </LogoWrap>
      <Button
        className="ms-welcome__action"
        buttonType={ButtonType.hero}
        iconProps={{ iconName: "ChevronRight" }}
        onClick={click}
      >
        Open popup dialog window demo
      </Button>

      <hr />
    </div>
  );
}

Help would be highly appreciated!

about 4 years ago · Juan Pablo Isaza
Answer question
Find remote jobs

Discover the new way to find a job!

Top jobs
Top job categories
Business
Post vacancy Pricing Sales
Legal
Terms and conditions Privacy policy
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Show me some job opportunities
There's an error!