preact icon indicating copy to clipboard operation
preact copied to clipboard

[preact/compact] Suppport react-is

Open clyfish opened this issue 2 years ago • 3 comments

Describe the feature you'd love to see Some libraries use react-is to check types of react element. Will @preact/compat support react-is? Additional context (optional) https://www.npmjs.com/package/react-is

// for example
import { isMemo, isFragment } from 'react-is'

clyfish avatar Feb 16 '23 06:02 clyfish

It's very unlikely that we'll ever support react-is. It relies on very react specific internals that no other third party library needs. If there is a need for something like react-is we'd rather add another entry to our package so that react-is can be aliased to that.

So far we haven't come across libraries checking for the type of react element. Can you share the ones you found?

marvinhagemeister avatar Feb 24 '23 14:02 marvinhagemeister

@marvinhagemeister antd and react-dnd depend on react-is, and more.

$ npm ls react-is
├─┬ [email protected]
│ └─┬ [email protected]
│   └── [email protected]
└─┬ [email protected]
  └─┬ [email protected]
    └── [email protected] deduped

clyfish avatar Feb 25 '23 13:02 clyfish

Great that isFragment is implemented! But isMemo is not yet implemented, and that breaks the Antd (and other) packages.

ziongh avatar Mar 13 '24 18:03 ziongh