Skip to content

Commit

Permalink
docs: use diff codeblock for useReducer typings change (facebook#31685
Browse files Browse the repository at this point in the history
)

## Summary

This PR updates the 19.0.0 changelog to use diff-styled code blocks for
illustrating changes to `useReducer` typings. Also removes the incorrect
square brackets in the second diff, it should be `Action` instead of
`[Action]`.


## How did you test this change?

**Before**


![2024-12-06_10-49](https://github.com/user-attachments/assets/bde94eec-a7cc-4fc8-bcca-37867633d37e)


**After**


![2024-12-06_10-51](https://github.com/user-attachments/assets/693fb7ac-68a3-45fc-aada-0c7594441b2a)

Signed-off-by: Eng Zer Jun <[email protected]>
  • Loading branch information
Juneezee authored Dec 6, 2024
1 parent c56c623 commit 65ba3e8
Showing 1 changed file with 9 additions and 5 deletions.
14 changes: 9 additions & 5 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -97,11 +97,15 @@ The most common changes can be codemodded with `npx types-react-codemod@latest p
* JSX namespace in TypeScript: The global `JSX` namespace is removed to improve interoperability with other libraries using JSX. Instead, the JSX namespace is available from the React package: `import { JSX } from 'react'`
* Better `useReducer` typings: Most `useReducer` usage should not require explicit type arguments.
For example,
\-useReducer\<React.Reducer\<State, Action\>\>(reducer)
\+useReducer(reducer)
or
\-useReducer\<React.Reducer\<State, Action\>\>(reducer)
\+useReducer\<State, \[Action\]\>(reducer)
```diff
-useReducer<React.Reducer<State, Action>>(reducer)
+useReducer(reducer)
```
or
```diff
-useReducer<React.Reducer<State, Action>>(reducer)
+useReducer<State, Action>(reducer)
```


## All Changes
Expand Down

0 comments on commit 65ba3e8

Please sign in to comment.