-
Notifications
You must be signed in to change notification settings - Fork 65
React 16 #109
New issue
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
React 16 #109
Conversation
@paf31 |
Are there any plans to merge this now that React 16 has been released? |
I would like to review this (against the release notes) before it's merged. |
Here are all the types that react supports:
Should we support I actually would prefer to not use a type class but a variant. This way one can render a list which consists of the various types, and avoids #105. |
Using a sum type will add a runtime overhead, since one will need to traverse an array and coerce its elements, so that's probably not the best approach. So at the end I think the class based approach is better. |
Also add `React.DOM.int` and `React.DOM.number` functions.
I like the class-based approach. However, I would also be open to an implementation using a sum too. On a side note, what does everything think about adding a class for class ReactCreateElement a
instance reactClassReactCreateElement :: ReactCreateElement (ReactClass props)
instance reactStatelessReactCreateElement :: ReactCreateElement (props -> ReactElement)
createElement :: forall props. ReactCreateElement class => class -> props -> Array ReactElement -> ReactElement |
-- | where | ||
-- | hellowWorldCls props = ... | ||
-- | ``` | ||
-- | Then the `displayName` will be set up to `HellowWorldCls` |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks for making these updates! I think this is great to have the Also, on a side note, is the |
It's just a convention in react ecosystem. Foreexample enzyme will look only for capitalised components. The |
Gotcha. Thanks for the info |
@coot it isn't merely a convention, lowercase and capitalized components are treated differently in JSX. Changing |
That's a good point. |
@ethul what about merging this PR? |
Thanks for the ping. I would like to take a bit more time to review all of these changes and dig into the display name further. I should be able to go through this over the next few days. Sorry for the delay! |
This solves #102. It may suffer from #105 if one is using props polymorphically, as in:
it would be nice to have a warning in this case, but I think that's impossible. It would need to be shown only if one is passing
cls
tocreateElement
directly but not if one is specialising the class. So it's ok to use the followinggoodCls
:but this leads to #105: