Textfield Component Issue

I want to set the state via onChange property on Textfield. But the error says Property 'value' does not exist on type 'EventTarget'.
How can I resolve this issue ?

    // ....
                                <Textfield placeholder="you@domain.com"
                                        value={email}
                                        onChange={e => setEmail(e.target.value)}
                                    {...fieldProps} />

Hi Fasetto – thanks for posting! I’ve replicated this in a codesandbox and was able to resolve the issue by specifying the type of the event passed into the onChange callback as a ChangeEvent; this event type always has a target with a value.

In your example you could do the following:

<Textfield placeholder="you@domain.com"
     value={email}
     onChange={(e: React.ChangeEvent<HTMLInputElement>) => {
           setEmail(e.target.value)
     }}
     {...fieldProps} 
/>

Let me know if this resolves the problem for you!

Thank you. Seems like it works. :slight_smile:
I saw this line on the sandbox: fieldProps.onChange(e); I think this is important because without this, event is not fired.