I'm trying to use React Bootstrap Form but I couldn't tape into the input and I deciced to try with the classic default one but it doesn't work as well(just if I paste something in). In the sandbox works perfectly but when I copy it in my page it doesn't.
import React, { Fragment, useState } from "react"
const StandAdd = () => {
const [test, setTest] = useState("")
const handleChange = event => {
event.preventDefault()
setTest(event.target.value)
}
const handleSubmit = event => {
alert("A name was submitted: " + test)
event.preventDefault()
}
return (
<form onSubmit={handleSubmit}>
<label>
Name:
<input type="text" value={test} onChange={handleChange} />
</label>
<input type="submit" value="Submit" />
</form>
)
}
export default StandAdd
Sandbox link https://codesandbox.io/s/react-input-vb2o1?file=/src/App.js
Any idea?
CodeSandboxexample works just fine - impossible to help without knowing what's going on in your actual app. Perhaps you're missing thoseonChangehandlers from some of your input fields in your actual code.event.preventDefault()in thehandleChangeevent handler.