0

despite of having higher react and react-dom version im facing the issue

const {login,setLogin} = useState({email:"",password:""});
const history = useHistory(); <--- facing error at this line (all the imports done perfectly)
1
  • 3
    the return of useState is tuple so const [login,setLogin]= useState({email:"",password:""}); Commented Jul 19, 2021 at 12:30

1 Answer 1

1

useState hook returns an Array so you need to do array destructuring instead of object destructuring

const [login,setLogin] = useState({email:"",password:""});
Sign up to request clarification or add additional context in comments.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.