Skip to content

Access to event target for form inputs #2169

Answered by abdhalees
GilbertQuinn asked this question in Q&A
Discussion options

You must be logged in to vote

Hello Gilbert,

is name the only property you need? if yes, you can pass the name in the handler function

const handleChange = (event, name) => {
    setFormData((prev) => ({ ...prev, [name]: value: event.detail.value }));
  };

<FormField label="Solution Name"> <Input type="text" name="solutionName" value={formData.solutionName} onChange={(e) => handleChange(e,"solutionName" )}/> </FormField>

Replies: 1 comment

Comment options

You must be logged in to vote
0 replies
Answer selected by just-boris
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Category
Q&A
Labels
None yet
2 participants