From e72f8fdc29ba900c4faf06d41d3cdb0413e648a3 Mon Sep 17 00:00:00 2001 From: Adrien HARNAY Date: Tue, 11 Dec 2018 10:44:14 +0100 Subject: [PATCH] Document createRef and forwardRef usage Fixes #72 --- README.md | 14 ++++++++++++++ 1 file changed, 14 insertions(+) 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 =
|| ; ``` [⇧ back to top](#table-of-contents) +#### `React.Ref>` +Type representing a React ref given as a second argument to a component by `forwardRef`, pointing to a native DOM component (e.g. `
`), or a user-defined composite component (e.g. ``) +```tsx +const Component = forwardRef((props: P, ref: React.Ref>) => ); +``` +[⇧ back to top](#table-of-contents) + +#### `React.RefObject

` +Type representing a React ref returned from `createRef`, pointing to a native DOM component (e.g. `

`), or a user-defined composite component (e.g. ``) +```tsx +const ref: React.RefObject

= React.createRef

(); +``` +[⇧ 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