What's up with the new types in React 19? Why is ReactNodesuddenly something different? It now throws a bunch of errors in places it didn't before. Is there a LegacyReactNode type or something I can use to get the old definitions, or should I define my own?
For example, if I have ReactNode as a property on a component, to be used in a certain place in the child elements, it throws a TS error—presumably because Promise<AwaitedReactNode> isn't a valid child. What's the solution for this?
reactjs - React 19 typescript add typeof web component - Stack Overflow
TypeScript type error with React 19 types
[React 19] Wrong `@types/react*` default version and build fails if the correct version is installed
In React v19, ref is now a prop. But how it would be using typescript?
Videos
» npm install @types/react
I saw lots of examples, but they seem to be made with jsx, like this:
function MyInput({ placeholder, ref }) {
return <input placeholder={placeholder} ref={ref} />;
}
<MyInput ref={React.createRef()} />
In this case, how would be the type of this ref prop? I'm asking this because with forwardRef() function, i have to give two types, because it needs (forwardRef<T, P = {}>).
So given all these information, how should i type this prop?