{"name":"react-is","version":"18.3.0-next-bfb9cbd8c-20230223","keywords":["react"],"license":"MIT","_id":"react-is@18.3.0-next-bfb9cbd8c-20230223","maintainers":[{"name":"gaearon","email":"dan.abramov@gmail.com"},{"name":"gnoff","email":"jcs.gnoff@gmail.com"},{"name":"fb","email":"opensource+npm@fb.com"},{"name":"sophiebits","email":"npm@sophiebits.com"},{"name":"react-bot","email":"react-core@meta.com"}],"homepage":"https://reactjs.org/","bugs":{"url":"https://github.com/facebook/react/issues"},"dist":{"shasum":"af0531a3dd7345d5528742e5e9fccdc7880720be","tarball":"http://registry-npm.ywwl.com/react-is/download/react-is-18.3.0-next-bfb9cbd8c-20230223.tgz","fileCount":8,"integrity":"sha512-aw42vB6DQk8fweZi01+t72iRQ4AiBIrLNDlR5vxRcWTSPuRwe8wJBdDxtjEWy+T2FcjKvL2a7EplSAUiCAAgmw==","signatures":[{"sig":"MEYCIQDr4rkxtH9xB9kh/g3R8uZEe0EgWSWPI2fruFvdxvmjPQIhAI8p9uflB7uXli6AVA+6oKMMLvFu06hB4tAEh87XrPIS","keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA"}],"unpackedSize":24063,"npm-signature":"-----BEGIN PGP SIGNATURE-----\r\nVersion: OpenPGP.js v4.10.10\r\nComment: https://openpgpjs.org\r\n\r\nwsFzBAEBCAAGBQJj+RA/ACEJED1NWxICdlZqFiEECWMYAoorWMhJKdjhPU1b\r\nEgJ2VmrRgA/7BXkxBrrQTeAVquf5s642mwV6XMWjBKQPHF1f4VidU9bVkN9j\r\nwj1g/lQ8nqCmi/sn3BuevXn8FyZQZs3mi6SmTubQ9LuvvkFx3WX6JgZzSaLY\r\nE/y0Nfn5O9w7elnE0LJh3ddMYRWwEWvhd31iJYgwyVnYkmvp0aAsyUmdq52S\r\nC5nPGvwjRnHmkY7/VxlydTomK00znKmUkO/3WxY770LpjDXn4/7sQVrt00lW\r\npWjY2q7ZkWc8T2c+zDLrWXtnqZqmrry8Q2It1aRyVZIoIcQI8HHmaOWZXC26\r\nkRSY1CiEkGGcjXMtsPj/4+tlOV89vOtgi+ceW5A7XOG+J5sF4ldsXWSt2eIS\r\nwLsOeSRqKOZlHX+Si37DD9RUtFzWKEjZGJV07x2tkwoJ+6oIIEAZ9oh5XlRL\r\nhb9gSzpFUslmB3hbEGhb60mtqPen6KRPiAh5FopdnwlZD43vrdUUJSRuKoal\r\n1dnbIsd+eLpIgwbXiVzdXfwdNjyXbJWzNLW2bUbbrHKmzp611YAh8G6blMUy\r\n/yAuqhotF/q0Sv5bUL8ABLWOJhzjz+WFe55v8fS5+6unJgDfoSKxDNlalIWs\r\nsR2hpPykM+oYAKu61m4FNRN/Wd/QP2u5cxVpT02bjwb9Eog7hqaZjFP37oC+\r\nD/xnPgzFfweoXMvPYTES6zvkwT2Jr7cHa7c=\r\n=EHYx\r\n-----END PGP SIGNATURE-----\r\n","size":5423,"noattachment":false,"key":"/react-is/-/react-is-18.3.0-next-bfb9cbd8c-20230223.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":"bfb9cbd8ca2d042677056110887cc62d438f665f","_npmUser":{"name":"react-bot","email":"react-core@meta.com"},"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_18.3.0-next-bfb9cbd8c-20230223_1677267007507_0.3226660301204616","host":"s3://npm-registry-packages"},"publish_time":1677267007687,"_cnpm_publish_time":1677267007687,"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"}}