{"name":"react-is","version":"0.0.0-experimental-9d4e8e84f-20220207","keywords":["react"],"license":"MIT","_id":"react-is@0.0.0-experimental-9d4e8e84f-20220207","maintainers":[{"name":"gaearon","email":"dan.abramov@gmail.com"},{"name":"acdlite","email":"npm@andrewclark.io"},{"name":"brianvaughn","email":"briandavidvaughn@gmail.com"},{"name":"fb","email":"opensource+npm@fb.com"},{"name":"trueadm","email":"dg@domgan.com"},{"name":"sophiebits","email":"npm@sophiebits.com"},{"name":"lunaruan","email":"lunaris.ruan@gmail.com"}],"homepage":"https://reactjs.org/","bugs":{"url":"https://github.com/facebook/react/issues"},"dist":{"shasum":"94947fbd85e844f10b897009c65f1922753152a5","tarball":"http://registry-npm.ywwl.com/react-is/download/react-is-0.0.0-experimental-9d4e8e84f-20220207.tgz","fileCount":8,"integrity":"sha512-jc6t8VQPnFbPA0krvk4X2yVG5bUkHiV9pQXZ2wl7vvemzJ72fPsmFTtCMXQuuRtY2yOcZWgJhJXQDtOy+NhNbQ==","signatures":[{"sig":"MEQCIHuoFwz74W4fPJmK6vu4Dy99M7BxUuTDJ4c0YIOXyhJ9AiAUxOGL8RSNoaH4T1D+po1gTztaSNLXsrTrOEYETMH4+g==","keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA"}],"unpackedSize":25470,"npm-signature":"-----BEGIN PGP SIGNATURE-----\r\nVersion: OpenPGP.js v3.0.13\r\nComment: https://openpgpjs.org\r\n\r\nwsFcBAEBCAAQBQJiApctCRA9TVsSAnZWagAA8h4P/31yWla9tw+p0WPwg8WR\nzxB24TLPPd8U419WCF//SvY0+jrQNwVnIKHJ+AReURJ+9tTwb0AyVMUt5GqR\nRjNmG52XVIcrSVPhKzHMMuDgqS34soSnaVzzCjoi2EcKmCrpEUnSFiDbdXQx\nje4wxuaDk7Xln/U5Z1WflB1pxOIh+f0y2Lt1HxohY8C0ZDqceLXo7bVBLqJx\nV4kUMESaKxV58rHKftxAVNHrJ2MYPK12OJ7BgMTsIFc0Y3srmli9evNGfaq8\ngF1ZOrgOKvkNCWGDbTfQFpdsP982loaycz4N4dNvJCOzTVMoSv6EWD6YqTY6\nHB3cLNoQZgaAoSoGpzE05Y2+DLp2qOmuZxhLxEaHnUY6eKshQG1pop/qWu0/\n21Tbd7Y1GU84uiiDU7qNzOdELOtpmuoNObi66KEhbWHwUgFhwoyVONNNH4Re\nP5cMGPI7GhX8kxbQLp3R2HQ05HR+CLQsvI55SaRjnn9UuuZerYel6S/QxGMd\nsEbgHdeh5QnGbiWF2Ja3oJ/93+uZNBcsAvkOMFCxe7E9Qy5MMyVIDSrGeyCv\nmFg65+gtt/Fle6ENI60IhrwdTO/AARuqeXbEQucqQZU4hn2IQpTrLhbZY86R\nVg8Bfj6aAJXh6y/uVicoi3JvcX+jhHQ86UiMC+tXORT2wiHQIJLXHmbVgUp4\nEKag\r\n=Wmkm\r\n-----END PGP SIGNATURE-----\r\n","size":5874,"noattachment":false,"key":"/react-is/-/react-is-0.0.0-experimental-9d4e8e84f-20220207.tgz"},"main":"index.js","readme":"# `react-is`\n\nThis package allows you to test arbitrary values and see if they're a particular React element type.\n\n## Installation\n\n```sh\n# Yarn\nyarn add react-is\n\n# NPM\nnpm install react-is\n```\n\n## Usage\n\n### Determining if a Component is Valid\n\n```js\nimport React from \"react\";\nimport * as ReactIs from \"react-is\";\n\nclass ClassComponent extends React.Component {\n  render() {\n    return React.createElement(\"div\");\n  }\n}\n\nconst FunctionComponent = () => React.createElement(\"div\");\n\nconst ForwardRefComponent = React.forwardRef((props, ref) =>\n  React.createElement(Component, { forwardedRef: ref, ...props })\n);\n\nconst Context = React.createContext(false);\n\nReactIs.isValidElementType(\"div\"); // true\nReactIs.isValidElementType(ClassComponent); // true\nReactIs.isValidElementType(FunctionComponent); // true\nReactIs.isValidElementType(ForwardRefComponent); // true\nReactIs.isValidElementType(Context.Provider); // true\nReactIs.isValidElementType(Context.Consumer); // true\nReactIs.isValidElementType(React.createFactory(\"div\")); // true\n```\n\n### Determining an Element's Type\n\n#### Context\n\n```js\nimport React from \"react\";\nimport * as ReactIs from 'react-is';\n\nconst ThemeContext = React.createContext(\"blue\");\n\nReactIs.isContextConsumer(<ThemeContext.Consumer />); // true\nReactIs.isContextProvider(<ThemeContext.Provider />); // true\nReactIs.typeOf(<ThemeContext.Provider />) === ReactIs.ContextProvider; // true\nReactIs.typeOf(<ThemeContext.Consumer />) === ReactIs.ContextConsumer; // true\n```\n\n#### Element\n\n```js\nimport React from \"react\";\nimport * as ReactIs from 'react-is';\n\nReactIs.isElement(<div />); // true\nReactIs.typeOf(<div />) === ReactIs.Element; // true\n```\n\n#### Fragment\n\n```js\nimport React from \"react\";\nimport * as ReactIs from 'react-is';\n\nReactIs.isFragment(<></>); // true\nReactIs.typeOf(<></>) === ReactIs.Fragment; // true\n```\n\n#### Portal\n\n```js\nimport React from \"react\";\nimport ReactDOM from \"react-dom\";\nimport * as ReactIs from 'react-is';\n\nconst div = document.createElement(\"div\");\nconst portal = ReactDOM.createPortal(<div />, div);\n\nReactIs.isPortal(portal); // true\nReactIs.typeOf(portal) === ReactIs.Portal; // true\n```\n\n#### StrictMode\n\n```js\nimport React from \"react\";\nimport * as ReactIs from 'react-is';\n\nReactIs.isStrictMode(<React.StrictMode />); // true\nReactIs.typeOf(<React.StrictMode />) === ReactIs.StrictMode; // true\n```\n","_npmUser":{"name":"acdlite","email":"npm@andrewclark.io"},"repository":{"url":"git+https://github.com/facebook/react.git","type":"git","directory":"packages/react-is"},"_npmVersion":"6.14.15","description":"Brand checking of React Elements.","directories":{},"_nodeVersion":"14.17.6","_hasShrinkwrap":false,"readmeFilename":"README.md","_npmOperationalInternal":{"tmp":"tmp/react-is_0.0.0-experimental-9d4e8e84f-20220207_1644336941758_0.4666847878506406","host":"s3://npm-registry-packages"},"publish_time":1644336941939,"_cnpm_publish_time":1644336941939,"dist-tags":{"backport":"19.1.10","beta":"19.0.0-beta-26f2496093-20240514","canary":"19.3.0-canary-edae846a-20261125","experimental":"0.0.0-experimental-edae846a-20261125","latest":"19.3.1","next":"19.3.0-canary-d5736f09-20260507","rc":"19.0.0-rc.1"}}