{"name":"react-is","version":"18.3.0-next-353c30252-20221202","keywords":["react"],"license":"MIT","_id":"react-is@18.3.0-next-353c30252-20221202","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":"e149a5f263d66875f8c5152d898b3981953de1d6","tarball":"http://registry-npm.ywwl.com/react-is/download/react-is-18.3.0-next-353c30252-20221202.tgz","fileCount":8,"integrity":"sha512-0mgTQZF45zx1M+J4Q24coZCZTmz+2BPAbl6Pzbbgm6wlFBLyM8VNkJPXxfGnRd8A95F6TPWZkGfi1ljMFXTwHw==","signatures":[{"sig":"MEUCIQDq+WPz7RWEYbllHd8CFWEasbEQNJQt6UKVNmM97sFMYAIgf9Wp9vRiadY6ZtiQO4guiAZVn6tP921XiDGEYShTt9Y=","keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA"}],"unpackedSize":23971,"npm-signature":"-----BEGIN PGP SIGNATURE-----\r\nVersion: OpenPGP.js v4.10.10\r\nComment: https://openpgpjs.org\r\n\r\nwsFzBAEBCAAGBQJjiiPuACEJED1NWxICdlZqFiEECWMYAoorWMhJKdjhPU1b\r\nEgJ2Vmqj3hAAgQlP+P/fw4kE+RVE1b7hwYQZAujw2y/qUJHUj9bZCXaFQ4FB\r\nlTCnplvUJs7cjbZlaJTbD41+974wirHSAFKkjVx9QSvP17RmyY4GQj1z432d\r\nmeqhhkIr+LRybM+bFw3J+S76yAT/C31ZEOx5ctF9Ana5GsbddBj8uMibhsAl\r\nhgm9d6gd8jAUs0B8kI1WmWU9szFab//fzZe0YvyKQX35eEbsIBgc7fQEUs4E\r\n/EUGVngFeFX1LUyNUAJpkbe8IqsoB0/Rp8m1w6XgvpZdErg52iwhYyX6Jauv\r\nOpbhgxpvWiBSz9QWWTjNNKuS0sHWC6hZMaHCxirzOLrUBeDctad9Rm9wxvGa\r\nFXUMBE96vWRC6lxpuYqcn1J4Htn/sSEI1H+43jtbX9HbEIZe1S88wvXNr8TI\r\nnruLlXvmKCHCSG5GrAi3EAY2PKirZZNBioCAZ48llJK3GqpjA2AGs9j5aXLu\r\nB8Lo9qSvv0eC0UUpkHQERm+vWLOJJydCJgb4gQlDNzZzBNkOnsjxJRGnvuXw\r\njcMcDTVURRHeCIXW3l7A4of0LuES9B3etbKlpsz7BEF0DyDInVE8uvrzDsk+\r\nbuebX7TdRPguSwFhSHsu9L5Kz6/ev6jzmPI7v75D6i0OPLFunuOoTL0X42nt\r\n2dDHgJ/Fddc3Ii63BfVB5CbHi7HEwBKeICE=\r\n=2VKA\r\n-----END PGP SIGNATURE-----\r\n","size":5407,"noattachment":false,"key":"/react-is/-/react-is-18.3.0-next-353c30252-20221202.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":"353c30252f67145fa8241b6979d570cb152c2b22","_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_18.3.0-next-353c30252-20221202_1669997550250_0.8338963330162523","host":"s3://npm-registry-packages"},"publish_time":1669997550441,"_cnpm_publish_time":1669997550441,"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"}}