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

Expose ReactCompositeComponentBase via React.__internals #843

Closed
insin opened this issue Jan 8, 2014 · 3 comments
Closed

Expose ReactCompositeComponentBase via React.__internals #843

insin opened this issue Jan 8, 2014 · 3 comments
Assignees

Comments

@insin
Copy link

insin commented Jan 8, 2014

Objects created with functions returned by React.createClass() are instanceof ReactCompositeComponentBase, but this constructor isn't exposed to end-users.

Adding it to React.__internals would enable this check for anyone who needs it.

Use case: creating a version of creationix/dombuilder which uses React.DOM functions instead of document.createElement() and need to detect objects which should be left as-is for React to deal with.

@sophiebits
Copy link
Collaborator

Does React.isValidClass or React.isValidComponent do what you want?

@ghost ghost assigned zpao Jan 8, 2014
@zpao
Copy link
Member

zpao commented Jan 9, 2014

I would really like to avoid adding anything to __internals and I would encourage you not to depend on that. That's basically there only to make the devtools work and I would like to kill it ASAP.

If @spicyj's suggestion doesn't work for you and you're doing this in node-land, you could require('react/lib/ReactCompositeComponent') directly. No guarantees on those APIs right now but it's there.

@insin
Copy link
Author

insin commented Jan 14, 2014

Both of those tips will do the job - thanks!

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

3 participants