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

toReactComponent for Hooks is reactComponent? #133

Closed
jamesdbrock opened this issue Dec 15, 2020 · 1 comment
Closed

toReactComponent for Hooks is reactComponent? #133

jamesdbrock opened this issue Dec 15, 2020 · 1 comment

Comments

@jamesdbrock
Copy link
Member

https://github.com/lumihq/purescript-react-basic/blob/d8087ade742a7070e35bbd999f45e373551c716d/src/React/Basic.purs#L70-L71

I have a question about toReactComponent.

I see it has moved to React.Basic.Classic, but it's still referenced here in React.Basic (and this documentation is re-exported in React.Basic.Hooks).

https://github.com/lumihq/purescript-react-basic-classic/blob/e0c21d61a92f36ff1f12fe972fb88d65e48cd927/src/React/Basic/Classic.purs#L280

It seems like for React FFI with Hooks toReactComponent has been replaced by reactComponent (and family) instead, right?

https://github.com/spicydonuts/purescript-react-basic-hooks/blob/5e43ca349a960c238e88219d0121603ae0c9889b/src/React/Basic/Hooks.purs#L88

So in reactComponent, what is the equivalent of the foreign-props-to-Purescript-props function ({ | jsProps } -> props) which was an argument to toReactComponent?

@maddie927
Copy link
Member

It has to do with requiring props to be an object. JS React requires this, but React.Basic.Classic.Component/ComponentSpec/make and React.Basic.Hooks.component do not. With React.Basic.Hooks.reactComponent/reactComponentWithChildren you're already interacting directly with JS React components and the object requirement is already there.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants