Skip to content
This repository has been archived by the owner on Sep 10, 2022. It is now read-only.

expose and document createElement and createHelper #116

Closed
wants to merge 1 commit into from

Conversation

pwmckenna
Copy link

Addresses #66.

Happy to update. It is certainly not perfect. There are a couple intentional omissions here:

  • introduced ReactChildrenType but didn't really know how to concisely document the type of children...but then again, neither do the react docs ;)
  • left out createHelpers's _helperLength, setDisplayName parameters. These don't seem to be used much even internally, and the leading underscore seems to indicate this should remain internal only, so I didn't document the optional params.

@codecov-io
Copy link

Current coverage is 100.00%

Merging #116 into master will not affect coverage as of 83ccc93

@@            master    #116   diff @@
======================================
  Files           42      42       
  Stmts          325     325       
  Branches         0       0       
  Methods          0       0       
======================================
  Hit            325     325       
  Partial          0       0       
  Missed           0       0       

Review entire Coverage Diff as of 83ccc93

Powered by Codecov. Updated on successful CI builds.

createElement(component: ReactElementType, props: Object, children: ReactChildrenType): ReactElementType
```

Creates a component similar to [`React.createElement`](https://facebook.github.io/react/docs/top-level-api.html#react.createelement), but safely handles assigning a key to a pure functional component by wrapping it in a class.
Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think you're confusing createElement() with toClass(). The purpose of the createElement() is to detect referentially transparent components and call them as functions rather than creating an unnecessary elements. See this doc for more details: https://github.com/acdlite/recompose/blob/master/docs/performance.md

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Fair enough, I'll update. I only really care about making createHelper public but it seemed rude to not take a crack at both.

Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Haha, not rude at all.

@acdlite
Copy link
Owner

acdlite commented Mar 22, 2016

Let's hold off on this until #117 is resolved. In the meantime, you can import createHelper at recompose/createHelper.

@pwmckenna pwmckenna closed this Mar 25, 2016
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

3 participants