--- name: react-is description: Use react-is 19 to identify React element brands and validate component types. Covers the React 19 export surface, the removal of React 18 async/concurrent aliases, and standalone checks that run without JSX, React, a DOM, or a test runner. --- Verified against react-is@19.2.8 on 2026-09-08. 2 of 2 examples executed. # react-is 19 `react-is` provides brand checks for arbitrary values and React element types. Import the package namespace: ```ts import * as ReactIs from "react-is"; ``` ## React 19 exports React 19 exposes these validation functions: - `isValidElementType` - `isElement` - `isFragment` - `isPortal` - `isStrictMode` - `isContextConsumer` - `isContextProvider` - `isForwardRef` - `isLazy` - `isMemo` - `isProfiler` - `isSuspense` - `isSuspenseList` It also exposes `typeOf`, which returns the React type brand for a React-created value, and these type-brand constants: - `Element` - `Fragment` - `Portal` - `StrictMode` - `ContextConsumer` - `ContextProvider` - `ForwardRef` - `Lazy` - `Memo` - `Profiler` - `Suspense` - `SuspenseList` ## Validate component types `isValidElementType` accepts a host element name such as `"div"` and component functions. It is a check for a value that React can use as an element type, not a check that a value is already an element. ```ts pmcp-example import * as assert from "node:assert/strict"; import * as ReactIs from "react-is"; function Component() { return null; } assert.equal(ReactIs.isValidElementType("div"), true); assert.equal(ReactIs.isValidElementType(Component), true); assert.equal(ReactIs.isValidElementType(null), false); assert.equal(ReactIs.isValidElementType({}), false); ``` ## Check arbitrary values without React or JSX All element predicates safely reject unrelated values. This makes them usable in a plain script, although a positive result generally requires a value created by React or ReactDOM. ```ts pmcp-example import * as assert from "node:assert/strict"; import * as ReactIs from "react-is"; const value = {}; assert.equal(ReactIs.isElement(value), false); assert.equal(ReactIs.isFragment(value), false); assert.equal(ReactIs.isPortal(value), false); assert.equal(ReactIs.isStrictMode(value), false); assert.equal(ReactIs.isContextConsumer(value), false); assert.equal(ReactIs.isContextProvider(value), false); assert.equal(ReactIs.isForwardRef(value), false); assert.equal(ReactIs.isLazy(value), false); assert.equal(ReactIs.isMemo(value), false); assert.equal(ReactIs.isProfiler(value), false); assert.equal(ReactIs.isSuspense(value), false); assert.equal(ReactIs.isSuspenseList(value), false); ``` ## React-created values With React available, use `typeOf` and the predicates against values created by React: - `typeOf(
) === Element` and `isElement()` identify an element. - `typeOf(<>>) === Fragment` and `isFragment(<>>)` identify a fragment. - `isStrictMode(