reselector icon indicating copy to clipboard operation
reselector copied to clipboard

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

Open qramilq opened this issue 3 years ago • 2 comments

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');

qramilq avatar Sep 30 '21 16:09 qramilq

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 avatar Sep 30 '21 16:09 lttb

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

vs-kurkin avatar Sep 30 '21 20:09 vs-kurkin