diff --git a/README.md b/README.md index 1a261b9..63df6cd 100644 --- a/README.md +++ b/README.md @@ -134,6 +134,20 @@ const elementOnly: React.ReactElement = <div /> || <MyComponent />; ``` [⇧ back to top](#table-of-contents) +#### `React.Ref<React.ReactElement<P>>` +Type representing a React ref given as a second argument to a component by `forwardRef`, pointing to a native DOM component (e.g. `<div />`), or a user-defined composite component (e.g. `<MyComponent />`) +```tsx +const Component = forwardRef((props: P, ref: React.Ref<React.ReactElement<P>>) => <Something />); +``` +[⇧ back to top](#table-of-contents) + +#### `React.RefObject<P>` +Type representing a React ref returned from `createRef`, pointing to a native DOM component (e.g. `<div />`), or a user-defined composite component (e.g. `<MyComponent />`) +```tsx +const ref: React.RefObject<P> = React.createRef<P>(); +``` +[⇧ back to top](#table-of-contents) + #### `React.ReactNode` Type representing any possible type of React node (basically ReactElement (including Fragments and Portals) + primitive JS types) ```tsx