I'm very new to React and Web Developing so please bear with me a little.
I'm building a simple web application with react and flask. I thought I could use the code from the Users.js file as a base to develop a registerUser.js script, as I needed some parts of the code. I had done this with a previous script, just changing the declaration accordingly( exp: export const ClassName = () => { } )
But it loads homepage instead. I thought maybe there was a mistake keeping it from loading correctly but I deleted all info and left just some text in yet it won't load this page (registeruser.js) and load homepage instead.
What could be keeping it from loading? I checked the browser and the address is correct (http://localhost:3000/registerUser)
this is my current code that wont load:
import React, { useState, useEffect, useRef, Fragment } from "react";
const API = process.env.REACT_APP_API;
export const RegisterUser = () => (
<Fragment>
<div className="row">
<h1>TEST TEXT</h1>
</div>
<div className="row">
<br></br>
</div>
<div className="row">
<h3>PLEASE LOAD</h3>
</div>
</Fragment>
);
And I'm loading the code from the navbar
import React from 'react'
import {Link} from 'react-router-dom'
export const Navbar = () => (
<nav className="navbar navbar-expand-lg navbar-light bg-light">
<Link className="navbar-brand" to="/">POLL ME APP</Link>
<button className="navbar-toggler" type="button" data-toggle="collapse" data-target="#navbarNav" aria-controls="navbarNav" aria-expanded="false" aria-label="Toggle navigation">
<span className="navbar-toggler-icon" />
</button>
<div className="collapse navbar-collapse" id="navbarNav">
<ul className="navbar-nav">
<li className="nav-item">
<Link className="nav-link" to="/registerUser">Register</Link>
</li>
</ul>
</div>
//other links
And it is declared in the App.js
import React from "react";
import { BrowserRouter as Router, Switch, Route } from "react-router-dom";
import './App.css';
//other imports
import { Registers } from "./components/Registers";
function App() {
return (
<Router>
<Navbar />
<div className="container p-4">
<Switch>
//other components
<Route path="/RegisterUser" component={RegisterUser} />
</Switch>
</div>
</Router>
);
}
export default App;