Question:
I have create two states for my input elements and used onChange to manipulate their state. Why do I get this error even when I have declared the variables in a destructured array? Can someone explain to me what I am doing wrong please
My app crashes with the below attached error –
Answer:
Variables
transactionName
,
setTransactionName
,
amount
and
setAmount
are not declared. You can either use
const
or
let
to declare them.
Check:
https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Operators/Destructuring_assignment
If you have better answer, please add a comment about this, thank you!