We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
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 ] } ]
The text was updated successfully, but these errors were encountered:
Yeah Component is just a type alias
Component
type Component props = Effect (props -> JSX)
so if you have an Array JSX that you want to return, the recommendation is to use fragment :: Array JSX -> JSX https://pursuit.purescript.org/packages/purescript-react-basic/17.0.0/docs/React.Basic#v:fragment
Array JSX
fragment :: Array JSX -> JSX
Sorry, something went wrong.
No branches or pull requests
The type of component function does not allow to create react component with Array JSX return.
The text was updated successfully, but these errors were encountered: