React 18: ref type error
See original GitHub issueIt seems that the type of the ref
property has changed in React 18.
<div ref={attr.container.ref}
The above example now gives the error:
Type '(node: ReactNode) => void' is not assignable to type 'LegacyRef<HTMLDivElement> | undefined'.
.
Issue Analytics
- State:
- Created a year ago
- Reactions:2
- Comments:5 (3 by maintainers)
Top Results From Across the Web
Bug: React 18 types broken since the type release a ... - GitHub
For errors in node_modules I'm currently working on an approach that restores as much of the React 17 types behavior as possible (see ......
Read more >Upgrading to React 18 with TypeScript - LogRocket Blog
The upgrade of the React type definitions to support React 18 involved some significant breaking changes that developers should know about.
Read more >React 18 TypeScript children FC - Stack Overflow
This error occurs when you are passing no props to the Component. children prop should be an optional prop. So giving those props...
Read more >Refs Must Have Owner Warning - React
This usually means that you're trying to add a ref to a component that doesn't have an owner (that is, was not created...
Read more >Refs and the DOM - React
When a ref is passed to an element in render , a reference to the node becomes accessible at the current attribute of...
Read more >
Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free
Top Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Addressed in 6.2.0. Thanks! ✨
Hi there! I’ve opened a PR since I required this fix as well.