Skip to content

How can I access event.target.value? #158

Open
@omefire

Description

@omefire

I am using the purescript-react library to create an app.

I am trying to handle an onChange event on an input element:

input [ Props.onChange $ \evt -> do

...

]

I want to access evt.target.value (as I would in Javascript).

Here's what the types look like:

type SyntheticInputEvent = SyntheticEvent_ (SyntheticUIEvent' ( SyntheticEvent' () ))

foreign import data SyntheticEvent_ :: # Type -> Type

type SyntheticUIEvent' r = (detail :: Number, view :: NativeAbstractView | r)

type SyntheticEvent' r = (bubbles :: Boolean, target :: NativeEventTarget, ... | r)

I have tried doing the following:

input [ Props.onChange $ evt -> do

let SyntheticEvent_ (SyntheticUIEvent' { detail: detail, view: view, target: target }) = evt

...

]

But that doesn't work.

Any suggestions?

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions