Update react monorepo to v19 #11
Reference in New Issue
Block a user
No description provided.
Delete Branch "renovate/react-monorepo"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
This PR contains the following updates:
17.0.38->19.2.7^17.0.2->^19.0.0^17.0.2->^19.0.0Release Notes
facebook/react (react)
v19.2.1Compare Source
React Server Components
v19.2.0Compare Source
Below is a list of all new features, APIs, and bug fixes.
Read the React 19.2 release post for more information.
New React Features
<Activity>: A new API to hide and restore the UI and internal state of its children.useEffectEventis a React Hook that lets you extract non-reactive logic into an Effect Event.cacheSignal(for RSCs) lets your know when thecache()lifetime is over.New React DOM Features
resume: to resume a prerender to a stream.resumeAndPrerender: to resume a prerender to HTML.resumeToPipeableStream: to resume a prerender to a stream.resumeAndPrerenderToNodeStream: to resume a prerender to HTML.prerenderAPIs to return apostponedstate that can be passed to theresumeAPIs.Notable changes
<ViewTransition>Component. React will batch as much reveals as possible before the first paint while trying to hit popular first-contentful paint metrics.prerender,renderToReadableStream) to server-side-rendering APIs for Node.js:IDs generated by useIdAll Changes
React
<Activity />was developed over many years, starting beforeClassComponent.setState(@acdlite @sebmarkbage and many others)%oplaceholder (@eps1lon #34198)useDeferredValueloop in popstate event (@acdlite #32821)useDeferredValue(@acdlite #34376)cacheSignal(@sebmarkbage #33557)React DOM
:for IDs generated byuseId(@sebmarkbage, @eps1lon: #32001, #33342#33099, #33422)nonceto be used on hoistable styles (@Andarist #32461)React.useinsideReact.lazy-ed Component (@hi-ogawa #33941)progressiveChunkSizeoption for server-side-rendering APIs (@sebmarkbage #33027)React Server Components
<img>and<link>using hints before they're rendered (@sebmarkbage #34604)filterStackFrame(@eps1lon #33707)React Reconciler
on*handlers to account for upcoming experimental APIsv19.1.2Compare Source
React Server Components
v19.1.1Compare Source
React
v19.1.0Compare Source
Owner Stack
An Owner Stack is a string representing the components that are directly responsible for rendering a particular component. You can log Owner Stacks when debugging or use Owner Stacks to enhance error overlays or other development tools. Owner Stacks are only available in development builds. Component Stacks in production are unchanged.
#32538, #32529, #32538
React
useIdto use valid CSS selectors, changing format from:r123:to«r123». #32001React DOM
hrefattribute is an empty string #31783getHoistableRoot()didn’t work properly when the container was a Document #32321<!-- -->) as a DOM container. #32250<script>and<template>tags to be nested within<select>tags. #31837use-sync-external-store
exportsfield topackage.jsonforuse-sync-external-storeto support various entrypoints. #25231React Server Components
unstable_prerender, a new experimental API for prerendering React Server Components on the server #31724registerServerReferencein client builds to handle server references in different environments. #32534v19.0.1Compare Source
React Server Components
v19.0.0Compare Source
Below is a list of all new features, APIs, deprecations, and breaking changes. Read React 19 release post and React 19 upgrade guide for more information.
New Features
React
startTransitioncan now accept async functions. Functions passed tostartTransitionare called “Actions”. A given Transition can include one or more Actions which update state in the background and update the UI with one commit. In addition to updating state, Actions can now perform side effects including async requests, and the Action will wait for the work to finish before finishing the Transition. This feature allows Transitions to include side effects likefetch()in the pending state, and provides support for error handling, and optimistic updates.useActionState: is a new hook to order Actions inside of a Transition with access to the state of the action, and the pending state. It accepts a reducer that can call Actions, and the initial state used for first render. It also accepts an optional string that is used if the action is passed to a formactionprop to support progressive enhancement in forms.useOptimistic: is a new hook to update state while a Transition is in progress. It returns the state, and a set function that can be called inside a transition to “optimistically” update the state to expected final value immediately while the Transition completes in the background. When the transition finishes, the state is updated to the new value.use: is a new API that allows reading resources in render. In React 19,useaccepts a promise or Context. If provided a promise,usewill suspend until a value is resolved.usecan only be used in render but can be called conditionally.refas a prop: Refs can now be used as props, removing the need forforwardRef.React DOM Client
<form> actionprop: Form Actions allow you to manage forms automatically and integrate withuseFormStatus. When a<form> actionsucceeds, React will automatically reset the form for uncontrolled components. The form can be reset manually with the newrequestFormResetAPI.<button> and <input> formActionprop: Actions can be passed to theformActionprop to configure form submission behavior. This allows using different Actions depending on the input.useFormStatus: is a new hook that provides the status of the parent<form> action, as if the form was a Context provider. The hook returns the values:pending,data,method, andaction.<head>section of the document.<head>on the client before revealing the content of a Suspense boundary that depends on that stylesheet.preinit,preload,prefetchDNS, andpreconnectAPIs to optimize initial page loads by moving discovery of additional resources like fonts out of stylesheet loading. They can also be used to prefetch resources used by an anticipated navigation.React DOM Server
prerenderandprerenderToNodeStreamAPIs for static site generation. They are designed to work with streaming environments like Node.js Streams and Web Streams. UnlikerenderToString, they wait for data to load for HTML generation.React Server Components
Deprecations
element.refaccess: React 19 supports ref as a prop, so we’re deprecatingelement.refin favor ofelement.props.ref. Accessing will result in a warning.react-test-renderer: In React 19, react-test-renderer logs a deprecation warning and has switched to concurrent rendering for web usage. We recommend migrating your tests to @testing-library/react or @testing-library/react-nativeBreaking Changes
React 19 brings in a number of breaking changes, including the removals of long-deprecated APIs. We recommend first upgrading to
18.3.1, where we've added additional deprecation warnings. Check out the upgrade guide for more details and guidance on codemodding.React
onUncaughtErrorandonCaughtErrormethods tocreateRootandhydrateRootto customize this error handling.propTypes: UsingpropTypeswill now be silently ignored. If required, we recommend migrating to TypeScript or another type-checking solution.defaultPropsfor functions: ES6 default parameters can be used in place. Class components continue to supportdefaultPropssince there is no ES6 alternative.contextTypesandgetChildContext: Legacy Context for class components has been removed in favor of thecontextTypeAPI.React.createFactory: Now that JSX is broadly supported, allcreateFactoryusage can be migrated to JSX components.react-test-renderer/shallow: This has been a re-export of react-shallow-renderer since React 18. If needed, you can continue to use the third-party package directly. We recommend using @testing-library/react or @testing-library/react-native instead.React DOM
react-dom/test-utils: We’ve movedactfromreact-dom/test-utilsto react. All other utilities have been removed.ReactDOM.render,ReactDOM.hydrate: These have been removed in favor of the concurrent equivalents:ReactDOM.createRootandReactDOM.hydrateRoot.unmountComponentAtNode: Removed in favor ofroot.unmount().ReactDOM.findDOMNode: You can replaceReactDOM.findDOMNodewith DOM Refs.Notable Changes
React
<Context>as a provider: You can now render<Context>as a provider instead of<Context.Provider>.useDeferredValueinitial value argument: When provided,useDeferredValuewill return the initial value for the initial render of a component, then schedule a re-render in the background with thedeferredValuereturned.useMemoanduseCallbackwill now reuse the memoized results from the first render, during the second render. Additionally, StrictMode will now double-invoke ref callback functions on initial mount.React DOM
TypeScript Changes
The most common changes can be codemodded with
npx types-react-codemod@latest preset-19 ./path-to-your-react-ts-files.ReactChild(replacement:React.ReactElement | number | string)ReactFragment(replacement:Iterable<React.ReactNode>)ReactNodeArray(replacement:ReadonlyArray<React.ReactNode>)ReactText(replacement:number | string)VoidFunctionComponent(replacement:FunctionComponent)VFC(replacement:FC)prop-types:Requireable,ValidationMap,Validator,WeakValidationMapcreate-react-class:ClassicComponentClass,ClassicComponent,ClassicElement,ComponentSpec,Mixin,ReactChildren,ReactHTML,ReactSVG,SFCFactoryuseRef: The initial argument is now required to matchuseState,createContextetcuseRef()are now always mutable instead of sometimes being immutable. This feature was too confusing for users and conflicted with legit cases where refs were managed by React and manually written to.ReactElementtyping: The props of React elements now default tounknowninstead ofanyif the element is typed asReactElementJSXnamespace is removed to improve interoperability with other libraries using JSX. Instead, the JSX namespace is available from the React package:import { JSX } from 'react'useReducertypings: MostuseReducerusage should not require explicit type arguments.For example,
All Changes
React
useActionState()hook to update state based on the result of a Form Action (#27270, #27278, #27309, #27302, #27307, #27366, #27370, #27321, #27374, #27372, #27397, #27399, #27460, #28557, #27570, #27571, #28631, #28788, #29694, #29695, #29694, #29665, #28232, #28319 by @acdlite, @eps1lon, and @rickhanlonii)use()API to read resources in render (#25084, #25202, #25207, #25214, #25226, #25247, #25539, #25538, #25537, #25543, #25561, #25620, #25615, #25922, #25641, #25634, #26232, #26536, #26739, #28233 by @acdlite, @MofeiZ, @sebmarkbage, @sophiebits, @eps1lon, and @hansottowirtz)useOptimistic()hook to display mutated state optimistically during an async mutation (#26740, #26772, #27277, #27453, #27454, #27936 by @acdlite)initialValueargument touseDeferredValue()hook (#27500, #27509, #27512, #27888, #27550 by @acdlite)element.refaccess (#28348, #28464, #28731 by @acdlite)<Context>to mean<Context.Provider>(#28226 by @gaearon)info,group, andgroupCollapsedin StrictMode logging (#25172 by @timneutkens)useSyncExternalStore()hydration in StrictMode (#26791 by @sophiebits)componentWillUnmount()in StrictMode (#26842 by @tyao1)useState()anduseReducer()initializer functions in StrictMode (#28248 by @eps1lon)useId()in StrictMode (#25713 by @gnoff)act()no longer checksshouldYieldwhich can be inaccurate in test environments (#26317 by @acdlite)react.elementsymbol toreact.transitional.element(#28813 by @sebmarkbage)useSyncExternalStore()re-render (#27199 by @acdlite)useSyncExternalStore()dropped update when state is dispatched in render phase (#25578 by @pandaiolo)RefreshRuntime.findAffectedHostInstances(#30538 by @gaearon)cache()API (#27977, #28250 by @acdlite and @gnoff)propTypes(#28324, #28326 by @gaearon)defaultPropssupport, except for classes (#28733 by @acdlite)createFactory(#27798 by @kassens)React DOM
useFormStatus()hook to provide status information of the last form submission (#26719, #26722, #26788, #29019, #28728, #28413 by @acdlite and @eps1lon)preinit,preinitModule,preconnect,prefetchDNS,preload, andpreloadModuleAPIs.fetchPriorityto<img>and<link>(#25927 by @styfle)transformOriginprop (#26130 by @arav-ind)onScrollEndevent (#26789 by @devongovett)<hr>as child of<select>(#27632 by @SouSingh)inert(#24730 by @eps1lon)imageSizesandimageSrcSet(#22550 by @eps1lon)flushSyncexhausts queue even if something throws (#26366 by @acdlite)reactandreact-domversions don’t match (#29236 by @acdlite)srcsetandsrcare assigned last on<img>instances (#30340 by @gnoff)srcandhrefattributes (unless for<a href=”” />) (#18513, #28124 by @bvaughn and @eps1lon)scalestyle property (#25601 by @JonnyBurger)onChangeerror message for controlled<select>(#27740 by @Biki-das)render,hydrate,findDOMNode,unmountComponentAtNode,unstable_createEventHandle,unstable_renderSubtreeIntoContainer, andunstable_runWithPriority. MovecreateRootandhydrateRoottoreact-dom/client. (#28271 by @gnoff)test-utils(#28541 by @eps1lon)unstable_flushControlled(#26397 by @kassens)renderToStaticNodeStream()(#28873 by @gnoff)unstable_renderSubtreeIntoContainer(#29771 by @kassens)React DOM Server
bootstrapScriptsandbootstrapModules(#25104 by @gnoff)bootstrapModules,bootstrapScripts, and update priority queue (#26754, #26753, #27190, #27189 by @gnoff)onHeadersentrypoint option (#27641, #27712 by @gnoff)<style>and<script>textContent to enable rendering inner content without dangerouslySetInnerHTML (#28870, #28871 by @gnoff)srcsetto trigger load event on mount (#30351 by @gnoff)onError(#27761, #27850 by @gnoff and @sebmarkbage)crossoriginsupport to bootstrap scripts (#26844 by @HenriqueLimas)nonceandfetchpriorityin preload links (#26826 by @liuyenwei)referrerPolicytoReactDOM.preload()(#27096 by @styfle)react/jsx-dev-runtime(#28921 by @himself65)errorInfo.digestfromonRecoverableError(#28222 by @gnoff)ReactTestRenderer
react-test-rendereron web (#27903, #28904 by @jackpope and @acdlite)react-test-renderer/shallowexport (#25475, #28497 by @sebmarkbage and @jackpope)React Reconciler
prepareUpdate(#26583, #27409 by @sebmarkbage and @sophiebits)React-Is
isConcurrentModeandisAsyncModemethods (#28224 by @gaearon)useSyncExternalStore
v18.3.1Compare Source
actfromreactf1338fv18.3.0Compare Source
This release is identical to 18.2 but adds warnings for deprecated APIs and other changes that are needed for React 19.
Read the React 19 Upgrade Guide for more info.
React
this.refsto support string ref codemod 909071findDOMNodeoutside StrictMode c3b283test-utilsmethods d4ea75defaultPropsfor function components #25699key#25697actfromtest-utilsd4ea75React DOM
unmountComponentAtNode8a015brenderToStaticNodeStream#28874v18.2.0Compare Source
React DOM
onRecoverableError. (@gnoff in #24591)documentcausing a blank page on mismatch. (@gnoff in #24523)setStatein Safari when adding an iframe. (@gaearon in #24459)React DOM Server
<title>elements to match the browser constraints. (@gnoff in #24679)highWaterMarkto0. (@jplhomer in #24641)Server Components (Experimental)
useId()inside Server Components. (@gnoff in #24172)v18.1.0Compare Source
React DOM
react-dom/clientwhen using UMD bundle. (@alireza-molaee in #24274)suppressHydrationWarningto work in production too. (@gaearon in #24271)componentWillUnmountfiring twice inside of Suspense. (@acdlite in #24308)useDeferredValuecausing an infinite loop when passed an unmemoized value. (@acdlite in #24247)setStateloop inuseEffect. (@gaearon in #24298)setStateinuseInsertionEffect. (@gaearon in #24295)React DOM Server
bootstrapScriptContentcontents. (@gnoff in #24385)renderToPipeableStream. (@gnoff in #24291)ESLint Plugin: React Hooks
Use Subscription
use-sync-external-storeshim. (@gaearon in #24289)v18.0.0Compare Source
Below is a list of all new features, APIs, deprecations, and breaking changes.
Read React 18 release post and React 18 upgrade guide for more information.
New Features
React
useIdis a new hook for generating unique IDs on both the client and server, while avoiding hydration mismatches. It is primarily useful for component libraries integrating with accessibility APIs that require unique IDs. This solves an issue that already exists in React 17 and below, but it’s even more important in React 18 because of how the new streaming server renderer delivers HTML out-of-order.startTransitionanduseTransitionlet you mark some state updates as not urgent. Other state updates are considered urgent by default. React will allow urgent state updates (for example, updating a text input) to interrupt non-urgent state updates (for example, rendering a list of search results).useDeferredValuelets you defer re-rendering a non-urgent part of the tree. It is similar to debouncing, but has a few advantages compared to it. There is no fixed time delay, so React will attempt the deferred render right after the first render is reflected on the screen. The deferred render is interruptible and doesn't block user input.useSyncExternalStoreis a new hook that allows external stores to support concurrent reads by forcing updates to the store to be synchronous. It removes the need foruseEffectwhen implementing subscriptions to external data sources, and is recommended for any library that integrates with state external to React.useInsertionEffectis a new hook that allows CSS-in-JS libraries to address performance issues of injecting styles in render. Unless you’ve already built a CSS-in-JS library we don’t expect you to ever use this. This hook will run after the DOM is mutated, but before layout effects read the new layout. This solves an issue that already exists in React 17 and below, but is even more important in React 18 because React yields to the browser during concurrent rendering, giving it a chance to recalculate layout.React DOM Client
These new APIs are now exported from
react-dom/client:createRoot: New method to create a root torenderorunmount. Use it instead ofReactDOM.render. New features in React 18 don't work without it.hydrateRoot: New method to hydrate a server rendered application. Use it instead ofReactDOM.hydratein conjunction with the new React DOM Server APIs. New features in React 18 don't work without it.Both
createRootandhydrateRootaccept a new option calledonRecoverableErrorin case you want to be notified when React recovers from errors during rendering or hydration for logging. By default, React will usereportError, orconsole.errorin the older browsers.React DOM Server
These new APIs are now exported from
react-dom/serverand have full support for streaming Suspense on the server:renderToPipeableStream: for streaming in Node environments.renderToReadableStream: for modern edge runtime environments, such as Deno and Cloudflare workers.The existing
renderToStringmethod keeps working but is discouraged.Configuration
📅 Schedule: Branch creation - At any time (no schedule defined), Automerge - At any time (no schedule defined).
🚦 Automerge: Enabled.
♻ Rebasing: Whenever PR is behind base branch, or you tick the rebase/retry checkbox.
🔕 Ignore: Close this PR and you won't be reminded about these updates again.
This PR has been generated by Renovate Bot.
b2446d54betoc6ef9782f0c6ef9782f0todd150f2acadd150f2acatof657467c3af657467c3atoafedce9c83afedce9c83to00fc88a1a700fc88a1a7to41e9d62c1841e9d62c18to99eb6ea64d99eb6ea64dtoa7a4b53668a7a4b53668tobca98ddd15bca98ddd15to3e72a3aeea3e72a3aeeato32e64d484632e64d4846to5a0d12b0295a0d12b029todc9d0e3d90dc9d0e3d90toed5010e585ed5010e585to0ed44df4390ed44df439to1102ca36d91102ca36d9todb0f9fc83cdb0f9fc83ctoeb3949291feb3949291fto126743bf2e126743bf2eto2d60805c082d60805c08tod900286502d900286502to5d2ac199df5d2ac199dfto56de8748f556de8748f5tob329c5adfdb329c5adfdto38410761973841076197toa97e7ada1ea97e7ada1eto39f5e0e79b39f5e0e79bto4e292878cf4e292878cfto777cb046bf777cb046bfto1e133767481e13376748tobc61f90039bc61f90039tob25598f20ab25598f20ato54438bc43e54438bc43eto5627d24c1a5627d24c1ato78fc71e59178fc71e591to3c8c9419a13c8c9419a1to176dc65a58176dc65a58toa3bfd46f71a3bfd46f71to0c0af2628a0c0af2628ato2f392a28bc2f392a28bcto7b057c20d07b057c20d0toe5f6041c4be5f6041c4bto1eb8f2afa71eb8f2afa7to6262480adc6262480adcto6afdbe2eec6afdbe2eecto111bdad2ac111bdad2actocec88651a7cec88651a7tob004131bd7b004131bd7to4a65c8e1644a65c8e164to4b294c5f5b4b294c5f5bto4af0b715124af0b71512to322df44676322df44676to518e8005fe518e8005feto7a4cf4157e7a4cf4157etod5513e8a16d5513e8a16to7c5408d8897c5408d889to99daa28c3199daa28c31to047016eacf047016eacftoda406a71dfda406a71dftofc5a6314a8fc5a6314a8to9e15af26079e15af2607toa65b3d0b32a65b3d0b32to90fe80a2a390fe80a2a3to1c03ca20401c03ca2040to396a6029d2⚠ Artifact update problem
Renovate failed to update an artifact related to this branch. You probably do not want to merge this PR as-is.
♻ Renovate will retry this branch, including artifacts, only when one of the following happens:
The artifact failure details are included below:
File name: pnpm-lock.yaml
396a6029d2to8264edfd358264edfd35to417d6dc970417d6dc970to769a1a946f769a1a946fto7ec6f0a4ca7ec6f0a4catoca7ace6f88ca7ace6f88tob23ac1905bb23ac1905btoe1800fa5e5e1800fa5e5to1cd99459ce1cd99459cetof851f2b237f851f2b237toeccda05e8eeccda05e8eto70ff7f9c2570ff7f9c25to4ca21cc2374ca21cc237to52a93bfd3952a93bfd39toeb3febc17aeb3febc17ato72d682335772d6823357to20866cd44f20866cd44fto42aaa75baa42aaa75baato960b12a3af960b12a3afto718c542c12718c542c12tof90c9d49f0f90c9d49f0to0da9536db40da9536db4toa002c8f8aea002c8f8aeto1054ab42801054ab4280toc4c4ae5f8bc4c4ae5f8bto39a27046bb39a27046bbtofd6a535933fd6a535933tof20acf83a0f20acf83a0to7f6470dcce7f6470dcceto5e71e5e8af5e71e5e8afto53dd0f8f2653dd0f8f26to1f72171e011f72171e01toabaf9f8b38abaf9f8b38to34631790a434631790a4tof5a4256ddaf5a4256ddato79190c317279190c3172to4eaea869034eaea86903to294c44b05d294c44b05dtof066ce7d37f066ce7d37to20f1d0276020f1d02760tobea4d6880fbea4d6880fto227955dd16227955dd16to226c28c30d226c28c30dtof6850afab7f6850afab7to38d30067b638d30067b6to300fa01ac4300fa01ac4to46d13d4fb346d13d4fb3to81bfac3af181bfac3af1to569ce70f08569ce70f08to3b9ad63a4b3b9ad63a4bto28cf4ad11d28cf4ad11dto198a325150⚠️ Artifact update problem
Renovate failed to update an artifact related to this branch. You probably do not want to merge this PR as-is.
♻ Renovate will retry this branch, including artifacts, only when one of the following happens:
The artifact failure details are included below:
File name: pnpm-lock.yaml
198a325150tof1acde67b1f1acde67b1toa5cae2266ea5cae2266eto77c2fcbd2177c2fcbd21to223ef4ab23223ef4ab23to915e652355915e652355tod1e07401bbd1e07401bbtodd55415c59dd55415c59tof184be7225f184be7225to3a1745876b3a1745876bto2af4c1f1132af4c1f113to5d05add6d2Update react monorepo to v18to Update react monorepo to v195d05add6d2to34042da8d134042da8d1toaf9622520baf9622520btoa89286ff02a89286ff02toa2d6dadb07a2d6dadb07toba3b9cfc65ba3b9cfc65to33b373ed4833b373ed48to939fb6f176939fb6f176toe90809277fe90809277ftof912cf53aff912cf53afto4ea1041cea4ea1041ceato2d277af8402d277af840to4b0416c5ee4b0416c5eetobd5ad63d5cbd5ad63d5cto8821ae1f968821ae1f96to515d0f8b49515d0f8b49to3d23d2fc453d23d2fc45tof690fb3873f690fb3873to27ac9c13d527ac9c13d5to08c6c4868a08c6c4868atoefeb328061efeb328061to04499a28a904499a28a9to0ebf9a3d790ebf9a3d79to3d0fb893143d0fb89314tob0e65a0ae0View command line instructions
Checkout
From your project repository, check out a new branch and test the changes.