{"name":"react-is","version":"18.3.0-next-02206099a-20220714","keywords":["react"],"license":"MIT","_id":"react-is@18.3.0-next-02206099a-20220714","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":"a7cd3eb18ed58bf1de187c2e98fcaf4ead50fbe7","tarball":"http://registry-npm.ywwl.com/react-is/download/react-is-18.3.0-next-02206099a-20220714.tgz","fileCount":8,"integrity":"sha512-2nDzmgbtYXrsPbKQ3G8/HwEgcztMJuebexQmFeWsdwjZJkOgHzr3IiDohJ5Q/Kl/Lgpgyf1QJ9frE1Q4pLiWNQ==","signatures":[{"sig":"MEUCIQDQxCb4tXDGZgfbHTD5BYu590SYTuINYTd8aG0esqzwPQIgFq9Dt81erQudZKKqQgIfGCRqbu/6Ub7WoAJ3vVqoUQM=","keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA"}],"unpackedSize":24037,"npm-signature":"-----BEGIN PGP SIGNATURE-----\r\nVersion: OpenPGP.js v4.10.10\r\nComment: https://openpgpjs.org\r\n\r\nwsFzBAEBCAAGBQJi0EEIACEJED1NWxICdlZqFiEECWMYAoorWMhJKdjhPU1b\r\nEgJ2VmpqAhAAhYLUECoWPuyRIUbZqjoQ8lLQzCfZ3EffdtRV34URT40IDYqv\r\nVcI33zxcQxIhZGqOAWgeI9H3In72PgzdI3k2aB74sP/9m586FCeaFKMMjvbZ\r\nRIqPlYAIOPeXS9ZMr2qvusXrpxqulIq/SaXgM+38KJ3v/pj1pq73Eu2Y2vuF\r\nSvbazQ3Sf0WAvpFMIB6bi1QLNU/PhcODhXwHW+KWDh7hI3LpUmqr0ooPvI1l\r\nkIbJoMMwSp+KsQqIbnyF7gLoMn0dSNERj1wXyJw8SBx8hYfKVi6p1887sO00\r\n6cOqNHYdsS/2V6wmyh5Ukj0zmabb6QISpO5GJc9ptuHRj7rA9e2xkMMesTlt\r\nSjituKTMASMfA5xKkZ12GRDawDtZqOBKAwIbE4Mj5mlYCy4bhNIYD2kW5qHB\r\nxY/rc/zhoQkLnU5/kW3bexEPP+D0WjlYY6GkZYt1yM5cRXNvp+Wyv4WTOG5K\r\n1MaquthDSjWi9Ixs/YakQLa/w14Nmmv0MwI9luuRISMj2MkvpwSZRYEQ+zEU\r\nLBNSAXzXYdY2hOnNiPEMBD8XHr1jc6/OxAp5mWmoIR7we0ALdpCzN0EcxTx7\r\n2ZKFi5qWlFA9fxeNUT04jsAKGZLmShvPxATQcen+LO1x4E/crs66U2UU2BSM\r\nT4WHsqyNP0NqMdKauplyOYG6m3c7Eojlevc=\r\n=T+3o\r\n-----END PGP SIGNATURE-----\r\n","size":5477,"noattachment":false,"key":"/react-is/-/react-is-18.3.0-next-02206099a-20220714.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_18.3.0-next-02206099a-20220714_1657815303785_0.6242581639864337","host":"s3://npm-registry-packages"},"publish_time":1657815304032,"_cnpm_publish_time":1657815304032,"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"}}