Skip to content

Topic/create element #37

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

Merged
merged 4 commits into from
Aug 31, 2015
Merged

Conversation

ethul
Copy link
Contributor

@ethul ethul commented Aug 12, 2015

Adds createElement that takes a component factory along with a set of props and creates a UI element. I am open for discussion on this one. However, the main use-case is to allow the developer to render their React components from within other React components.

ethul added 2 commits August 11, 2015 22:52
The createElement function takes a component factory and props and
creates a new component that can be nested in other components.
@paf31
Copy link
Contributor

paf31 commented Aug 12, 2015

Can the factory get access to the children property?

@ethul
Copy link
Contributor Author

ethul commented Aug 12, 2015

Good point. I think adding something like:

foreign import getChildren :: forall props eff.  UIRef -> Eff (props :: ReactProps props | eff) (Array UI)

Would allow the component to get the passed-in children. I can add this to this PR.

Allows for access to the implicit `children` prop on components.
@paf31
Copy link
Contributor

paf31 commented Aug 14, 2015

I'm not very familiar with this function, but if you're able to verify it works on an example, I'm happy to merge it.

@ethul
Copy link
Contributor Author

ethul commented Aug 14, 2015

Great! I will add an example. And props.children is basically an implicit property containing the children for a component. For reference: https://facebook.github.io/react/tips/children-props-type.html

@ethul
Copy link
Contributor Author

ethul commented Aug 29, 2015

Just wanted to send a ping on this. Does the above example for createElement look okay?

paf31 added a commit that referenced this pull request Aug 31, 2015
@paf31 paf31 merged commit 91d07ac into purescript-contrib:master Aug 31, 2015
@paf31
Copy link
Contributor

paf31 commented Aug 31, 2015

👍 Sorry for the delay.

@ethul
Copy link
Contributor Author

ethul commented Aug 31, 2015

No problem. Thanks for the merge!

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

Successfully merging this pull request may close these issues.

2 participants