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

Can't use with new JSX Transform from react 17+ #108

Open
qramilq opened this issue Sep 30, 2021 · 2 comments
Open

Can't use with new JSX Transform from react 17+ #108

qramilq opened this issue Sep 30, 2021 · 2 comments
Labels
bug Something isn't working

Comments

@qramilq
Copy link

qramilq commented Sep 30, 2021

Hello, thank you for this library, but I can't use it with new JSX Transform introduced in React 17.
I have debugged the reselector's source code and found, that in this line isElement function always returns false, because in the new jsx runtime transform we don't have in this line name === 'React' and property === 'createElement'. At the current moment I don't found any solution how to detect if jsx compiled to
_jsx('h1', { children: 'Hello world' });
instead to
React.createElement('h1', null, 'Hello world');

@lttb
Copy link
Contributor

lttb commented Sep 30, 2021

hey, thanks for reporting!

the possible solution is to get the name of imported jsx from react/jsx-runtime by ImportSpecifier, and also check that caller name in isReactElement

I can take a look this weekend, but feel free to let us know if you'd like to send a PR 😊

@lttb lttb added the bug Something isn't working label Sep 30, 2021
@vs-kurkin
Copy link

Спасибо, Артур!)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

3 participants