Skip to content

Conversation

@eps1lon
Copy link
Collaborator

@eps1lon eps1lon commented Mar 28, 2023

Implements https://twitter.com/dan_abramov/status/1640157848167489541
Stacked on #64896 (Diff against #64896)

useRef now requires an explicit initial value. This is in line with documentation and createContext

-const ref = React.useRef<T>()
+const ref = React.useRef<T>(undefined)
 //     ^? React.RefObject<T | undefined>

Just like for const current: T | null = useRef<T>(null).current we'll have a convenience overload for useRef<T>(undefined) that ensures ref.current will be T | undefined.

@eps1lon eps1lon force-pushed the feat/react/useRef-required branch from f8d98e5 to 40d0aa6 Compare December 5, 2023 21:15
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants