| 1 | --- |
| 2 | title: React 19 API Changes |
| 3 | impact: MEDIUM |
| 4 | impactDescription: cleaner component definitions and context usage |
| 5 | tags: react19, refs, context, hooks |
| 6 | --- |
| 7 | |
| 8 | ## React 19 API Changes |
| 9 | |
| 10 | > **⚠️ React 19+ only. |
| 11 | |
| 12 | In React 19, `ref` is now a regular prop (no `forwardRef` wrapper needed), and ` |
| 13 | |
| 14 | **Incorrect (forwardRef in React 19):** |
| 15 | |
| 16 | ```tsx |
| 17 | const ComposerInput = forwardRef |
| 18 | return <TextInput |
| 19 | }); |
| 20 | ``` |
| 21 | |
| 22 | **Correct (ref as a regular prop):** |
| 23 | |
| 24 | ```tsx |
| 25 | function ComposerInput({ ref |
| 26 | return <TextInput |
| 27 | } |
| 28 | ``` |
| 29 | |
| 30 | **Incorrect (useContext in React 19):** |
| 31 | |
| 32 | ```tsx |
| 33 | const value = useContext |
| 34 | ``` |
| 35 | |
| 36 | **Correct (use instead of useContext):** |
| 37 | |
| 38 | ```tsx |
| 39 | const value = use |
| 40 | ``` |
| 41 | |
| 42 | `use()` can also be called conditionally, unlike `useContext()`. |