#Need help with React Web App

3 messages · Page 1 of 1 (latest)

runic fulcrum
#

I was making a blogs edit form in react I added an input like this -

<input
type="text"
className="form-control border border-dark"
id="author"
name="author"
value={data}
onChange={handleInputChange}
/>
```(I've defined data)

when I am trying to change the value of input, it doesn't let me.
my guess is that it is refilling the input with the data
half spindle
runic fulcrum
#
const handleInputChange = (e) => {
        const name = e.target.name;
        const value = e.target.value;
        switch (name) {
            case "title":
                setTitle(value);
                break;
            case "content":
                setContent(value);
                break;
            case "author":
                setAuthor(value);
                break;
            default:
                return;
        }
    };
```