My English may not be the best, but I am working on creating a Login Page. The issue I'm facing is that when I click the Login button, I want to navigate to the Home Page I designed using React. However, whenever I try to implement Link or Route commands for redirection, the screen turns completely white without any error messages. Interestingly, everything functions properly once I remove the code related to redirection.
import React from "react";
import 'bootstrap/dist/css/bootstrap.min.css';
import './App_login.css'
import logo from "./assets/resim.png"
import { BrowserRouter, Route, Routes, Link } from 'react-router-dom';
import Sifre from './App_sifre'
import Anasayfa from './App_anasayfa'
import Login from './App_login'
function App() {
return (
<body className="bg">
<div className="container" >
<div className="card card-body mt-5 pb-5 shadow p-3 mb-5 bg-body rounded ">
<BrowserRouter>
<div>
<Routes>
<Route path='/' element= {<Login />} />
<Route path='/sifre' element= {<Sifre />} />
<Route path='/anasayfa' element= {<Anasayfa />} />
</Routes>
</div>
</BrowserRouter>
<h2 className="text-center text-info ">DMS Planlama Sistemi</h2>
<div className="row mt-5 pb-5">
<div className="col-lg-6 col-sm-12 mb-5">
<img src={logo} alt="login" className="img-fluid" />
</div>
<div className="col-lg-6 col-sm-12">
<form>
<div className="form-group">
<label htmlFor="email">Kullanıcı Adı:</label>
<input type="email" className="form-control" placeholder="Kullanıcı adınız" id="email" />
</div>
<div className="form-group">
<label htmlFor="pwd" style={{marginTop: '15px'}}>Şifre:</label>
<input type="password" className="form-control" placeholder="şifreniz" id="pwd" />
</div>
<div className="form-group form-check">
<label className="form-check-label">
<input className="form-check-input" type="checkbox" /> Beni Hatırla
<label><a href="şifremi unuttum/şifre yenileme.html" to="/sifre" style={{marginLeft: '30px'}}>Şifremi unuttum</a></label>
</label>
</div>
<button type="submit" className="btn btn-primary" href="anasayfa/anasayfa.html">
<Link to="/anasayfa"> Login</Link>
</button>
</form>
</div>
</div>
</div>
</div>
</body>
);
}
export default App;
I've attempted to utilize Link and Route commands by importing the necessary files for routing purposes.