Skip to content

Encoding optional props with ReactPropFields #151

Closed
@jvliwanag

Description

@jvliwanag

On the current master, createLeafElement has the signature:

-- | Create an element from a React class that does not require children.
createLeafElement :: forall required given.
  ReactPropFields required given =>
  ReactClass { | required } ->
  { | given } ->
  ReactElement

I used to be able to use Union for encoding react classes with optional prop fields defined such as:

foreign import fooClass :: forall props. ReactClass props

foo :: forall o t
           . Union o t ( title :: String )
           => {|o}
           -> ReactElement
foo = createLeafElement fooClass

Wherein I can call foo {} or foo {title: "hello"}. But it seems the new ReactPropFields constraint now prevents me from doing this. Any suggested way getting around this?

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