Update react monorepo to v19 #11
Loading…
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.0.2
^17.0.2
->^19.0.0
^17.0.2
->^19.0.0
Release Notes
facebook/react (react)
v19.0.0
Compare 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
startTransition
can now accept async functions. Functions passed tostartTransition
are 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 formaction
prop 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,use
accepts a promise or Context. If provided a promise,use
will suspend until a value is resolved.use
can only be used in render but can be called conditionally.ref
as a prop: Refs can now be used as props, removing the need forforwardRef
.React DOM Client
<form> action
prop: Form Actions allow you to manage forms automatically and integrate withuseFormStatus
. When a<form> action
succeeds, React will automatically reset the form for uncontrolled components. The form can be reset manually with the newrequestFormReset
API.<button> and <input> formAction
prop: Actions can be passed to theformAction
prop 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
, andpreconnect
APIs 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
prerender
andprerenderToNodeStream
APIs 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.ref
access: React 19 supports ref as a prop, so we’re deprecatingelement.ref
in 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
onUncaughtError
andonCaughtError
methods tocreateRoot
andhydrateRoot
to customize this error handling.propTypes
: UsingpropTypes
will now be silently ignored. If required, we recommend migrating to TypeScript or another type-checking solution.defaultProps
for functions: ES6 default parameters can be used in place. Class components continue to supportdefaultProps
since there is no ES6 alternative.contextTypes
andgetChildContext
: Legacy Context for class components has been removed in favor of thecontextType
API.React.createFactory
: Now that JSX is broadly supported, allcreateFactory
usage 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 movedact
fromreact-dom/test-utils
to react. All other utilities have been removed.ReactDOM
.render
,ReactDOM
.hydrate
: These have been removed in favor of the concurrent equivalents:ReactDOM
.createRoot
andReactDOM.hydrateRoot
.unmountComponentAtNode
: Removed in favor ofroot.unmount()
.ReactDOM
.findDOMNode
: You can replaceReactDOM
.findDOMNode
with DOM Refs.Notable Changes
React
<Context>
as a provider: You can now render<Context>
as a provider instead of<Context.Provider>
.useDeferredValue
initial value argument: When provided,useDeferredValue
will return the initial value for the initial render of a component, then schedule a re-render in the background with thedeferredValue
returned.useMemo
anduseCallback
will 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
,WeakValidationMap
create-react-class
:ClassicComponentClass
,ClassicComponent
,ClassicElement
,ComponentSpec
,Mixin
,ReactChildren
,ReactHTML
,ReactSVG
,SFCFactory
useRef
: The initial argument is now required to matchuseState
,createContext
etcuseRef()
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.ReactElement
typing: The props of React elements now default tounknown
instead ofany
if the element is typed asReactElement
JSX
namespace is removed to improve interoperability with other libraries using JSX. Instead, the JSX namespace is available from the React package:import { JSX } from 'react'
useReducer
typings: MostuseReducer
usage should not require explicit type arguments.For example, or
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)initialValue
argument touseDeferredValue()
hook (#27500, #27509, #27512, #27888, #27550 by @acdlite)element.ref
access (#28348, #28464, #28731 by @acdlite)<Context>
to mean<Context.Provider>
(#28226 by @gaearon)info
,group
, andgroupCollapsed
in 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 checksshouldYield
which can be inaccurate in test environments (#26317 by @acdlite)react.element
symbol 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)defaultProps
support, 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
, andpreloadModule
APIs.fetchPriority
to<img>
and<link>
(#25927 by @styfle)transformOrigin
prop (#26130 by @arav-ind)onScrollEnd
event (#26789 by @devongovett)<hr>
as child of<select>
(#27632 by @SouSingh)inert
(#24730 by @eps1lon)imageSizes
andimageSrcSet
(#22550 by @eps1lon)flushSync
exhausts queue even if something throws (#26366 by @acdlite)react
andreact-dom
versions don’t match (#29236 by @acdlite)srcset
andsrc
are assigned last on<img>
instances (#30340 by @gnoff)src
andhref
attributes (unless for<a href=”” />
) (#18513, #28124 by @bvaughn and @eps1lon)scale
style property (#25601 by @JonnyBurger)onChange
error message for controlled<select>
(#27740 by @Biki-das)render
,hydrate
,findDOMNode
,unmountComponentAtNode
,unstable_createEventHandle
,unstable_renderSubtreeIntoContainer
, andunstable_runWithPriority
. MovecreateRoot
andhydrateRoot
toreact-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
bootstrapScripts
andbootstrapModules
(#25104 by @gnoff)bootstrapModules
,bootstrapScripts
, and update priority queue (#26754, #26753, #27190, #27189 by @gnoff)onHeaders
entrypoint option (#27641, #27712 by @gnoff)<style>
and<script>
textContent to enable rendering inner content without dangerouslySetInnerHTML (#28870, #28871 by @gnoff)srcset
to trigger load event on mount (#30351 by @gnoff)onError
(#27761, #27850 by @gnoff and @sebmarkbage)crossorigin
support to bootstrap scripts (#26844 by @HenriqueLimas)nonce
andfetchpriority
in preload links (#26826 by @liuyenwei)referrerPolicy
toReactDOM.preload()
(#27096 by @styfle)react/jsx-dev-runtime
(#28921 by @himself65)errorInfo.digest
fromonRecoverableError
(#28222 by @gnoff)ReactTestRenderer
react-test-renderer
on web (#27903, #28904 by @jackpope and @acdlite)react-test-renderer/shallow
export (#25475, #28497 by @sebmarkbage and @jackpope)React Reconciler
prepareUpdate
(#26583, #27409 by @sebmarkbage and @sophiebits)React-Is
isConcurrentMode
andisAsyncMode
methods (#28224 by @gaearon)useSyncExternalStore
v18.3.1
Compare Source
act
fromreact
f1338fv18.3.0
Compare 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.refs
to support string ref codemod 909071findDOMNode
outside StrictMode c3b283test-utils
methods d4ea75defaultProps
for function components #25699key
#25697act
fromtest-utils
d4ea75React DOM
unmountComponentAtNode
8a015brenderToStaticNodeStream
#28874v18.2.0
Compare Source
React DOM
onRecoverableError
. (@gnoff in #24591)document
causing a blank page on mismatch. (@gnoff in #24523)setState
in Safari when adding an iframe. (@gaearon in #24459)React DOM Server
<title>
elements to match the browser constraints. (@gnoff in #24679)highWaterMark
to0
. (@jplhomer in #24641)Server Components (Experimental)
useId()
inside Server Components. (@gnoff in #24172)v18.1.0
Compare Source
React DOM
react-dom/client
when using UMD bundle. (@alireza-molaee in #24274)suppressHydrationWarning
to work in production too. (@gaearon in #24271)componentWillUnmount
firing twice inside of Suspense. (@acdlite in #24308)useDeferredValue
causing an infinite loop when passed an unmemoized value. (@acdlite in #24247)setState
loop inuseEffect
. (@gaearon in #24298)setState
inuseInsertionEffect
. (@gaearon in #24295)React DOM Server
bootstrapScriptContent
contents. (@gnoff in #24385)renderToPipeableStream
. (@gnoff in #24291)ESLint Plugin: React Hooks
Use Subscription
use-sync-external-store
shim. (@gaearon in #24289)v18.0.0
Compare 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
useId
is 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.startTransition
anduseTransition
let 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).useDeferredValue
lets 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.useSyncExternalStore
is a new hook that allows external stores to support concurrent reads by forcing updates to the store to be synchronous. It removes the need foruseEffect
when implementing subscriptions to external data sources, and is recommended for any library that integrates with state external to React.useInsertionEffect
is 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 torender
orunmount
. 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.hydrate
in conjunction with the new React DOM Server APIs. New features in React 18 don't work without it.Both
createRoot
andhydrateRoot
accept a new option calledonRecoverableError
in case you want to be notified when React recovers from errors during rendering or hydration for logging. By default, React will usereportError
, orconsole.error
in the older browsers.React DOM Server
These new APIs are now exported from
react-dom/server
and 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
renderToString
method 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 becomes conflicted, 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.
b2446d54be
toc6ef9782f0
c6ef9782f0
todd150f2aca
dd150f2aca
tof657467c3a
f657467c3a
toafedce9c83
afedce9c83
to00fc88a1a7
00fc88a1a7
to41e9d62c18
41e9d62c18
to99eb6ea64d
99eb6ea64d
toa7a4b53668
a7a4b53668
tobca98ddd15
bca98ddd15
to3e72a3aeea
3e72a3aeea
to32e64d4846
32e64d4846
to5a0d12b029
5a0d12b029
todc9d0e3d90
dc9d0e3d90
toed5010e585
ed5010e585
to0ed44df439
0ed44df439
to1102ca36d9
1102ca36d9
todb0f9fc83c
db0f9fc83c
toeb3949291f
eb3949291f
to126743bf2e
126743bf2e
to2d60805c08
2d60805c08
tod900286502
d900286502
to5d2ac199df
5d2ac199df
to56de8748f5
56de8748f5
tob329c5adfd
b329c5adfd
to3841076197
3841076197
toa97e7ada1e
a97e7ada1e
to39f5e0e79b
39f5e0e79b
to4e292878cf
4e292878cf
to777cb046bf
777cb046bf
to1e13376748
1e13376748
tobc61f90039
bc61f90039
tob25598f20a
b25598f20a
to54438bc43e
54438bc43e
to5627d24c1a
5627d24c1a
to78fc71e591
78fc71e591
to3c8c9419a1
3c8c9419a1
to176dc65a58
176dc65a58
toa3bfd46f71
a3bfd46f71
to0c0af2628a
0c0af2628a
to2f392a28bc
2f392a28bc
to7b057c20d0
7b057c20d0
toe5f6041c4b
e5f6041c4b
to1eb8f2afa7
1eb8f2afa7
to6262480adc
6262480adc
to6afdbe2eec
6afdbe2eec
to111bdad2ac
111bdad2ac
tocec88651a7
cec88651a7
tob004131bd7
b004131bd7
to4a65c8e164
4a65c8e164
to4b294c5f5b
4b294c5f5b
to4af0b71512
4af0b71512
to322df44676
322df44676
to518e8005fe
518e8005fe
to7a4cf4157e
7a4cf4157e
tod5513e8a16
d5513e8a16
to7c5408d889
7c5408d889
to99daa28c31
99daa28c31
to047016eacf
047016eacf
toda406a71df
da406a71df
tofc5a6314a8
fc5a6314a8
to9e15af2607
9e15af2607
toa65b3d0b32
a65b3d0b32
to90fe80a2a3
90fe80a2a3
to1c03ca2040
1c03ca2040
to396a6029d2
⚠ 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
396a6029d2
to8264edfd35
8264edfd35
to417d6dc970
417d6dc970
to769a1a946f
769a1a946f
to7ec6f0a4ca
7ec6f0a4ca
toca7ace6f88
ca7ace6f88
tob23ac1905b
b23ac1905b
toe1800fa5e5
e1800fa5e5
to1cd99459ce
1cd99459ce
tof851f2b237
f851f2b237
toeccda05e8e
eccda05e8e
to70ff7f9c25
70ff7f9c25
to4ca21cc237
4ca21cc237
to52a93bfd39
52a93bfd39
toeb3febc17a
eb3febc17a
to72d6823357
72d6823357
to20866cd44f
20866cd44f
to42aaa75baa
42aaa75baa
to960b12a3af
960b12a3af
to718c542c12
718c542c12
tof90c9d49f0
f90c9d49f0
to0da9536db4
0da9536db4
toa002c8f8ae
a002c8f8ae
to1054ab4280
1054ab4280
toc4c4ae5f8b
c4c4ae5f8b
to39a27046bb
39a27046bb
tofd6a535933
fd6a535933
tof20acf83a0
f20acf83a0
to7f6470dcce
7f6470dcce
to5e71e5e8af
5e71e5e8af
to53dd0f8f26
53dd0f8f26
to1f72171e01
1f72171e01
toabaf9f8b38
abaf9f8b38
to34631790a4
34631790a4
tof5a4256dda
f5a4256dda
to79190c3172
79190c3172
to4eaea86903
4eaea86903
to294c44b05d
294c44b05d
tof066ce7d37
f066ce7d37
to20f1d02760
20f1d02760
tobea4d6880f
bea4d6880f
to227955dd16
227955dd16
to226c28c30d
226c28c30d
tof6850afab7
f6850afab7
to38d30067b6
38d30067b6
to300fa01ac4
300fa01ac4
to46d13d4fb3
46d13d4fb3
to81bfac3af1
81bfac3af1
to569ce70f08
569ce70f08
to3b9ad63a4b
3b9ad63a4b
to28cf4ad11d
28cf4ad11d
to198a325150
⚠️ 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
198a325150
tof1acde67b1
f1acde67b1
toa5cae2266e
a5cae2266e
to77c2fcbd21
77c2fcbd21
to223ef4ab23
223ef4ab23
to915e652355
915e652355
tod1e07401bb
d1e07401bb
todd55415c59
dd55415c59
tof184be7225
f184be7225
to3a1745876b
3a1745876b
to2af4c1f113
2af4c1f113
to5d05add6d2
Update react monorepo to v18to Update react monorepo to v195d05add6d2
to34042da8d1
34042da8d1
toaf9622520b
af9622520b
toa89286ff02
Checkout
From your project repository, check out a new branch and test the changes.