{"name":"react-is","version":"0.0.0-experimental-edbfc6399-20221128","keywords":["react"],"license":"MIT","_id":"react-is@0.0.0-experimental-edbfc6399-20221128","maintainers":[{"name":"gaearon","email":"dan.abramov@gmail.com"},{"name":"acdlite","email":"npm@andrewclark.io"},{"name":"gnoff","email":"jcs.gnoff@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":"55146ae89767462a13e80909172e894944323afa","tarball":"http://registry-npm.ywwl.com/react-is/download/react-is-0.0.0-experimental-edbfc6399-20221128.tgz","fileCount":8,"integrity":"sha512-kN3yOLAlexIWGMSsDSo6OUIAwXsr/6B3U6uzlTN9+O5Ckr+j4+jHTUR6Of6cUZFFnibQR7vOl1rXR2U2W+R5sA==","signatures":[{"sig":"MEQCIC774cwzccDPRGHhuULAU3HkaaNpT+8TYTsixCvNERIbAiArbrO03qEDo2Ox6NsYA8fVJLSXv/vcfwwI018380sg/w==","keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA"}],"unpackedSize":24098,"npm-signature":"-----BEGIN PGP SIGNATURE-----\r\nVersion: OpenPGP.js v4.10.10\r\nComment: https://openpgpjs.org\r\n\r\nwsFzBAEBCAAGBQJjhi/zACEJED1NWxICdlZqFiEECWMYAoorWMhJKdjhPU1b\r\nEgJ2VmqSaA/+JLqCShHHGm7oJwTP3+FW45kvBOEnIQx21K+zLYhZLFRVkaEa\r\ntUdqRNDzh5cGZooxz49Uub+b8N7Lfmkzf152ORsN/s5TvHC8M4+E914f6dpn\r\nHwClQoM2V3BXu3MtDo95whHiUuNWNTItav3baAhzptPNRM7jSKmG6ehTJfol\r\n3ssgMcT0MHkLGJ6HozTF/fXIzYBDBBOzYjnfjcZZCx4qaUZvTbwIMnbLhGQP\r\n4Scrrby0UOW5xsehubWUZdFKMYYguu5OmmTFl+ZfJO8tDM7WZb1OAEWBD4aB\r\ny5yT9iPnyJwCv8UJSEX2nVieN+8t4rdCLGBSZo1heHA2lJQ/KIRSoh5oqBoH\r\ntbhguUeRAPg3BeZ+lkQulTMitWxswdJpNsuVx2UtDaVyNp0PYdE56ippv3cc\r\n22ba+noQQxK2tdpJcFiqxP8bA+U4CNyhX50vKVuKirBUG3W6x/N/VnbTAu8u\r\nWilib847IjLvQW8/8SQreqNvdEEILI23cauiapBxwdfHGM0uUaN0FbbYtfyy\r\nbeto+IP7lZDIWZ0x3b7jCnxXKDt8XYgiBlCudFxOVBxOzx7h/i/Lek23zef6\r\nNldrdLv4aE6Y8GznR0iiRhlyW9IvK7gz1oA0cBNFEHReFcIqzedNnBW/KwJV\r\n/9eYFU9SN1QjNrY4qSki6R5PDdkX/s5mgwQ=\r\n=wMTw\r\n-----END PGP SIGNATURE-----\r\n","size":5429,"noattachment":false,"key":"/react-is/-/react-is-0.0.0-experimental-edbfc6399-20221128.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","gitHead":"edbfc6399ffa31267a2e884a63194b5ea17514ff","_npmUser":{"name":"acdlite","email":"npm@andrewclark.io"},"repository":{"url":"git+https://github.com/facebook/react.git","type":"git","directory":"packages/react-is"},"_npmVersion":"8.11.0","description":"Brand checking of React Elements.","directories":{},"_nodeVersion":"16.16.0","_hasShrinkwrap":false,"readmeFilename":"README.md","_npmOperationalInternal":{"tmp":"tmp/react-is_0.0.0-experimental-edbfc6399-20221128_1669738483065_0.8421897274649459","host":"s3://npm-registry-packages"},"publish_time":1669738483251,"_cnpm_publish_time":1669738483251,"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"}}