{"name":"react-is","version":"0.0.0-experimental-39a3b72c6-20230414","keywords":["react"],"license":"MIT","_id":"react-is@0.0.0-experimental-39a3b72c6-20230414","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":"46319dfa4cd08dc1d5e1ea93085ea1db8f3aeb74","tarball":"http://registry-npm.ywwl.com/react-is/download/react-is-0.0.0-experimental-39a3b72c6-20230414.tgz","fileCount":8,"integrity":"sha512-csZ0G4MKCZ1Tr0Ei0KWSfFXVtoVPlgGw8z9hfkFlpxyFr7GPp0FzyWwj9o9Zf9Cqt0MkUn0auwNTef1YSEyGCg==","signatures":[{"sig":"MEQCIBgdpUputyXfqRp9T/26RgVI0G/qT//XPrmLkg5OznVcAiBTPZEa2YxRxpHendOq9PbznCZsHcEBRK78yMFc4dhYJw==","keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA"}],"unpackedSize":24188,"npm-signature":"-----BEGIN PGP SIGNATURE-----\r\nVersion: OpenPGP.js v4.10.10\r\nComment: https://openpgpjs.org\r\n\r\nwsFzBAEBCAAGBQJkOXvbACEJED1NWxICdlZqFiEECWMYAoorWMhJKdjhPU1b\r\nEgJ2Vmo1LQ//aDIWWY8/w/N6fM6lJssaZpAhPJaJBD0oQGmFQAJZmvZF8lWW\r\nesqN+6Zi2Z/AClJbcjgcMPPwmjE7kU6X7ld/UwuoieWUirWyzo2XVJjLaEZu\r\nrv9/9q6tcIU6G9E4+x0DR1YKiFCdQVD6yYtow56J3OHL7ga/Z1c9wv9qNVFy\r\nff84SbGw/M3Wl7PolO7pOmthfCh+ZZNz67VNX7MSVAfJLuHa+4zugnc1YwhQ\r\n8yodJB/9PBTKi/tlKtyds5V7ieVRq6tPY8fm7pzxQURac5734R4AERZ1NckY\r\nU29dUezn7dDYub7Icc0BBvflSJapQuV2VqXltxvVb1sGuCQtZ55DgVJBeGbc\r\nl0ll3S9VZYVP2agv7+zPK/Sws4pNX3A+cehPcRXzjxD0fgV/dvphRSa52Ldv\r\nuPGrpVM4PooH7vL4Oi78Oyj6S0XQv5goRD937s/7FRo3Kiw84TkLzIx8DL41\r\nkAyEXOR3fKysk94xQ5vp2bYFeP5KbGB2HxNEe2XvaOqMUishsaqQhxali/E8\r\ndkL3o2agT5xaeCC5V4s3uHjX90icRSo9TZ0i50oF5UP5hDrp02vSeUXD7u+t\r\nuVwoAuEpVrb1TRlpusaxk4r39L8kxqoEPTbiSe+HoZ4QJoHOqeNwsPimLB5K\r\n2BKIew3f5YbuBjwykNvOCuVxILsyfxhUx8k=\r\n=JoKe\r\n-----END PGP SIGNATURE-----\r\n","size":5441,"noattachment":false,"key":"/react-is/-/react-is-0.0.0-experimental-39a3b72c6-20230414.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":"39a3b72c6db97c58c45b0dd9b685b316cd2302c3","_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_0.0.0-experimental-39a3b72c6-20230414_1681488859721_0.16286482244613754","host":"s3://npm-registry-packages"},"publish_time":1681488859913,"_cnpm_publish_time":1681488859913,"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"}}