Skip to content

[new] [react-is] add typeOfElementType, extracted from typeOf #15349

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

Closed
wants to merge 2 commits into from

Conversation

ljharb
Copy link
Contributor

@ljharb ljharb commented Apr 8, 2019

By extracting this functionality, I'll be able to simplify the logic in enzyme here by comparing directly to the type rather than needing to make a fake element.

@eps1lon
Copy link
Collaborator

eps1lon commented Apr 8, 2019

Prior art: #12932

This is already implemented for memo and lazy since ReactIs.isMemo(MemoComponent) returns true rather than ReactIs.isMemo(<MemoComponent />). See #14546 for more details about inconsistencies in the API between memo, lazy and forwardRef.

@ljharb
Copy link
Contributor Author

ljharb commented May 4, 2019

cc @gaearon this would be a nice simplification to make in enzyme :-)

@ljharb ljharb force-pushed the react-is-type-of-element-type branch from 1387e2d to bb380e4 Compare June 6, 2019 05:56
@ljharb
Copy link
Contributor Author

ljharb commented Jun 6, 2019

ping - just rebased this. any thoughts from react collabs?

@sizebot
Copy link

sizebot commented Jun 6, 2019

No significant bundle size changes to report.

Generated by 🚫 dangerJS

@stale
Copy link

stale bot commented Jan 10, 2020

This pull request has been automatically marked as stale because it has not had recent activity. It will be closed if no further activity occurs. Thank you for your contribution.

@stale stale bot added the Resolution: Stale Automatically closed due to inactivity label Jan 10, 2020
@ljharb
Copy link
Contributor Author

ljharb commented Jan 10, 2020

This isn't stale, it's just been ignored by collaborators.

(Please don't use stalebots, they're incredibly user-hostile)

@stale stale bot removed the Resolution: Stale Automatically closed due to inactivity label Jan 10, 2020
@stale
Copy link

stale bot commented Apr 9, 2020

This pull request has been automatically marked as stale. If this pull request is still relevant, please leave any comment (for example, "bump"), and we'll keep it open. We are sorry that we haven't been able to prioritize reviewing it yet. Your contribution is very much appreciated.

@stale stale bot added the Resolution: Stale Automatically closed due to inactivity label Apr 9, 2020
@ljharb
Copy link
Contributor Author

ljharb commented Apr 9, 2020

bump

@stale
Copy link

stale bot commented Jul 11, 2020

This pull request has been automatically marked as stale. If this pull request is still relevant, please leave any comment (for example, "bump"), and we'll keep it open. We are sorry that we haven't been able to prioritize reviewing it yet. Your contribution is very much appreciated.

@stale stale bot added the Resolution: Stale Automatically closed due to inactivity label Jul 11, 2020
@ljharb
Copy link
Contributor Author

ljharb commented Jul 11, 2020

eternally relevant.

@stale stale bot removed the Resolution: Stale Automatically closed due to inactivity label Jul 11, 2020
@stale
Copy link

stale bot commented Oct 12, 2020

This pull request has been automatically marked as stale. If this pull request is still relevant, please leave any comment (for example, "bump"), and we'll keep it open. We are sorry that we haven't been able to prioritize reviewing it yet. Your contribution is very much appreciated.

@stale stale bot added the Resolution: Stale Automatically closed due to inactivity label Oct 12, 2020
@ljharb
Copy link
Contributor Author

ljharb commented Oct 12, 2020

bump redux

@pablopalacios
Copy link

pablopalacios commented May 25, 2021

Any update on this one? If I'm not missing anything, having this functionality would be very useful for hocs that forward refs to wrapped components.

@redonkulus
Copy link

@gaearon @sebmarkbage 🙏 🙏 🙏 🙏 🙏 🙏 🙏

@stale
Copy link

stale bot commented Jan 9, 2022

This pull request has been automatically marked as stale. If this pull request is still relevant, please leave any comment (for example, "bump"), and we'll keep it open. We are sorry that we haven't been able to prioritize reviewing it yet. Your contribution is very much appreciated.

@stale stale bot added the Resolution: Stale Automatically closed due to inactivity label Jan 9, 2022
@ljharb
Copy link
Contributor Author

ljharb commented Jan 9, 2022

eternabump

@stale stale bot removed the Resolution: Stale Automatically closed due to inactivity label Jan 9, 2022
@sebmarkbage sebmarkbage deleted the branch facebook:master October 20, 2022 20:41
@ljharb
Copy link
Contributor Author

ljharb commented Oct 20, 2022

um, what happened here? please reopen this.

@gaearon
Copy link
Collaborator

gaearon commented Oct 20, 2022

Apologies for closing — we've accidentally pushed a master branch to the repo (due to an old fork), then deleted it, and this lead to a bunch of PRs getting auto-closed.

That said, I don't think we'd want to expand the surface of react-is as we've moved away from recommending introspection (e.g. it won't work with Server Components), and making assumptions about element types makes it more difficult to make changes in React itself (e.g. switch between reconciler and "userland" memo and lazy implementations). So I don't think we'll be adding this.

@ljharb ljharb deleted the react-is-type-of-element-type branch October 20, 2022 23:22
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

8 participants