{"name":"react-is","version":"18.0.0-alpha-64931821a-20210808","keywords":["react"],"license":"MIT","_id":"react-is@18.0.0-alpha-64931821a-20210808","maintainers":[{"name":"sebmarkbage","email":"sebastian@calyptus.eu"},{"name":"gaearon","email":"dan.abramov@gmail.com"},{"name":"acdlite","email":"npm@andrewclark.io"},{"name":"brianvaughn","email":"briandavidvaughn@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":"7665f5d2950139fe1cbf48087f86f2bfdca9dab7","tarball":"http://registry-npm.ywwl.com/react-is/download/react-is-18.0.0-alpha-64931821a-20210808.tgz","fileCount":8,"integrity":"sha512-ftHWljUHZyOl7OudkyTouXHoprU+MW0FSPumV6y/UfG7UZhtKBOYdq3uzyf7XeVhhHTznvtBDDf10Uq/zWnX1A==","signatures":[{"sig":"MEUCIQDPYc0o9ym/YaJMWNTman/hK0YsXYyOG9o5uqxGJbVJmgIgEODZF0f/YSZ+Tj9jmb115ZmBNHBhjOcvqmrP33eakT8=","keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA"}],"unpackedSize":25692,"npm-signature":"-----BEGIN PGP SIGNATURE-----\r\nVersion: OpenPGP.js v3.0.13\r\nComment: https://openpgpjs.org\r\n\r\nwsFcBAEBCAAQBQJhEVQoCRA9TVsSAnZWagAAB/AP/1PyscKY/SjTvaANZUFs\nwBWqh5vIxU76ShAGJp1fgDJOUeIecg4aX9WQkglMwNMlVS9JFjliJ9WT3VHE\n4MjDEoiEEu5+W7WrGOPzYvHQlMF0O9eXuSCoyEAM7kptiEnDiXM/JNoV/AIN\n/xpu0Kzgkt38VmMNLzL3KIr3Ci5Q99pw+nLGj1pzegpGTeULSSm1G8UBKERQ\nb06GgWtjeE99z5C3lFPmqylIY7nbIi+q0i/+qW/tvlhph1eIA/pY++u+sUCd\nlwuPtkufBIBLb6lhA5/5MwAhIS5J8zQ8fY4Jng8gLCuYBQGNFhm/58JjTwkr\nuYK+9QR1WO0VQfHn8JUENA4VBhguD9NJajAl04lqHIj60SCL6PJxd+4xbZLw\n8ODry6C4WFQSNH0ynTG45K3AtqDWUI4/eDw5TPwPGJRfekpRBLub0KKHm9Cs\npc0vBc5SCJOeuiYZrDJS5A1DC+20nYcrXIRaA4de7uwoQKLOExKtMAqLSF7H\ntTsY5y2x6vdFQ9NrWL4UNc58jSxG4NsPM7G5C59TNXw2XykmSGttSLCouBC3\n0XF7lHiDG0Ns5s8WsK6CmJnW4Gd2wjsGoZGFmqLbTqT24uJtBAlo0rOSnwC2\navjFZqsgzslbs71CUQQZlkcMZq6ZwH4RqRdvWkGW7EPeDwBjrkPaFzIJL3iv\n5lF5\r\n=8XNk\r\n-----END PGP SIGNATURE-----\r\n","size":5907,"noattachment":false,"key":"/react-is/-/react-is-18.0.0-alpha-64931821a-20210808.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.14","description":"Brand checking of React Elements.","directories":{},"_nodeVersion":"14.17.4","_hasShrinkwrap":false,"readmeFilename":"README.md","_npmOperationalInternal":{"tmp":"tmp/react-is_18.0.0-alpha-64931821a-20210808_1628525608207_0.27796510267220076","host":"s3://npm-registry-packages"},"publish_time":1628525608370,"_cnpm_publish_time":1628525608370,"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"}}