mirror of
https://github.com/zebrajr/react.git
synced 2026-01-15 12:15:22 +00:00
docs: use diff codeblock for useReducer typings change (#31685)
## 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**  **After**  Signed-off-by: Eng Zer Jun <engzerjun@gmail.com>
This commit is contained in:
14
CHANGELOG.md
14
CHANGELOG.md
@@ -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
|
||||
|
||||
Reference in New Issue
Block a user