Skip to content
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

towards react-16 #102

Closed
coot opened this issue Jul 1, 2017 · 5 comments
Closed

towards react-16 #102

coot opened this issue Jul 1, 2017 · 5 comments

Comments

@coot
Copy link

coot commented Jul 1, 2017

React 16 will allow to return arrays (or maybe even more general iterators) from within render method. We can have a few choices how to support that.

  • using variants in render codomain
  • or adding a function of type wrap :: Array ReactElement -> ReactElement which would be just unsafeCoerce

The second choice would easier to adopt in existing projects, the first one would break a lot of classes. We could add a new type to avoid that though.

@paf31
Copy link
Contributor

paf31 commented Jul 6, 2017

Another option is to make the type of render polymorphic in the spec type, and then to use a type class (with no members) to constrain the return type.

@coot
Copy link
Author

coot commented Jul 8, 2017

Do you mean sth like this:

class ReactRender a

instance arrayReactRender :: ReactRender (Array ReactElement)

instance reactElementReactRender :: ReactRender ReactElement

-- | A render function.
type Render props state render eff =
  ReactThis props state ->
  Eff
    ( props :: ReactProps
    , refs :: ReactRefs Disallowed
    , state :: ReactState ReadOnly
    | eff
    ) render

spec :: forall props state render eff.
  ReactRender render =>
  state -> Render props state render eff -> ReactSpec props state render eff

The problem with this approach is that it's not backward compatible, but maybe that's fine.

@suzumiyasmith
Copy link

"Warning: Accessing createClass via the main React package is deprecated, and will be removed in React v16.0. Use a plain JavaScript class instead. If you're not yet ready to migrate, create-react-class v15.* is available on npm as a temporary, drop-in replacement. For more info see https://fb.me/react-create-class"

And I got this warning while running js generated by thermite.

@paulyoung
Copy link
Contributor

@suzumiyasmith I think that should have been addressed by #99

@coot coot mentioned this issue Aug 5, 2017
@ethul
Copy link
Contributor

ethul commented Nov 2, 2017

Closed by #109

@ethul ethul closed this as completed Nov 2, 2017
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Development

No branches or pull requests

5 participants