-
-
Notifications
You must be signed in to change notification settings - Fork 10.7k
Closed as duplicate of#14020
Description
The RSCStaticRouter
introduced in #13700 makes use of the React.use()
hook. This API does not exist in stable versions of React 18 and is only available in React 19 (reference: React 18 docs).
react-router/packages/react-router/lib/rsc/server.ssr.tsx
Lines 102 to 103 in 35718a3
// @ts-expect-error - need to update the React types | |
const payload = React.use(getPayload()) as RSCPayload; |
The peer dependency range for react declares compatibility with any version greater than or equal to 18:
react-router/packages/react-router/package.json
Lines 138 to 139 in c3f9f23
"peerDependencies": { | |
"react": ">=18", |
This will likely result in runtime problems for apps using React 18. For those bundling with webpack (out of fashion, I know), build time breaks with the following error:
ERROR in ../../node_modules/.pnpm/[email protected][email protected][email protected][email protected]/node_modules/react-router/dist/development/chunk-T3VM44WY.mjs 2499:18-28
export 'use' (imported as 'React5') was not found in 'react' (possible exports: Children, Component, Fragment, Profiler, PureComponent, StrictMode, Suspense, __SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED, cloneElement, createContext, createElement, createFactory, createRef, forwardRef, isValidElement, lazy, memo, startTransition, unstable_act, useCallback, useContext, useDebugValue, useDeferredValue, useEffect, useId, useImperativeHandle, useInsertionEffect, useLayoutEffect, useMemo, useReducer, useRef, useState, useSyncExternalStore, useTransition, version)
Metadata
Metadata
Assignees
Labels
No labels