I am following an example of React/JavaScript. In this example, the author wrote the codes about const with a usage I have never seen. I tried to search online but found nothing. I'd like to get an answer and learn more about the usage here. thanks. The codes are like this:
import React, { useEffect, useState } from "react";
function Login() {
const [email, setEmail] = useState("");
const [password, setPassword] = useState("");
const navigation = useUavigate();
useEffect(()=> {
if(loading){
returen;
}
if (user) navigate("/dashborad");
}, [user, loading]);
return (
<input
type="text"
value = {email}
onChange = {(e)=> setEmail(e.target.value)}
/>
// omit other input and button codes
}
export default Login;