TypeScript, 'onChange' is specified more than once, so this usage will be

Viewed 5597

I'm using material-ui, react-hook-form and Typescript in a react project, and when I try to add onChange in TextField VScode show me and error:

'onChange' is specified more than once, so this usage will be overwritten.ts(2783) formComponent.tsx(33, 15): This spread always overwrites this property.

formComponent.tsx :

        <TextField
          variant="standard"
          defaultValue={projectData.name}
          onChange={handleSubmit((data) => console.log(data))}
          {...register('name', { required: true })}
          error={!!errors.name}
        />
1 Answers
Related