0
I have error line 9. useState is not define. Thanks you sir
Error line 9. Use state is not define https://code.sololearn.com/WuT98SC0Hej0/?ref=app
1 Answer
+ 1
You never imported useState from react, so you need to type React.useState()
Also useState hook is used inside component not outside as you type, so place this inside.
Same is for methods you are using, like method to handle submit, inside this you access value of state, you can only do this inside component, or by sending this data to other component(parent to children and children to parent) or by using something like redux.
https://code.sololearn.com/Wlp1h7aieT3Z/?ref=app