You are calling the onChange
function but you never declared it.
1. The input field
From what I can see you have to only do 2 small changes to get the input working correctly:
- Declare another state variable:
const [input, setInput] = useState("");
- Change your input
onChange
parameter to:
onChange="event => setInput(event.target.value)"
This should make the text input work.
2. The file input field
For the file input, make sure you read this
Because its value is read-only, it is an uncontrolled component in React. [...] You should use the File API to interact with the files.
Some more docs:
https://reactjs.org/docs/forms.html#controlled-components
Forms as functional components with react
https://rangle.io/blog/simplifying-controlled-inputs-with-hooks/