-1

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;
Duo Xu
  • 9
  • 2
  • in line 3 , 4 It is just Destructuring . take a look at this: https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Operators/Destructuring_assignment – Ebay May 07 '22 at 14:17

0 Answers0