purescript-react-basic-hooks icon indicating copy to clipboard operation
purescript-react-basic-hooks copied to clipboard

Array of JSX is not allowed

Open avi892nash opened this issue 1 year ago • 1 comments

The type of component function does not allow to create react component with Array JSX return.

This should get compile, because react library allowes this syntax.

mkCounter :: Component Int
mkCounter = do
  component "Counter" \initialValue -> React.do
    counter /\ setCounter <- useState initialValue

    pure
      $ [ R.button
          { onClick: handler_ do
              setCounter (_ + 1)
          , children:
              [ R.text $ "Increment: " <> show counter ]
          }
          ]

avi892nash avatar Jun 13 '24 07:06 avi892nash