Skip to content

Commit

Permalink
fix: translation (#1585)
Browse files Browse the repository at this point in the history
  • Loading branch information
loveloki authored Sep 10, 2024
2 parents f62e305 + e4f85d9 commit 69a1e64
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion src/content/learn/typescript.md
Original file line number Diff line number Diff line change
Expand Up @@ -228,7 +228,7 @@ export default App = AppTSX;
- `const initialState: State` 为初始 state 提供类型,并且也将成为 `useReducer` 默认使用的类型。
- `stateReducer(state: State, action: CounterAction): State` 设置了 reducer 函数参数和返回值的类型。

`useReducer` 提供类型参数的更明确的替代方法是在 `initialState` 上设置类型
除了在 `initialState` 上设置类型外,一个更明确的替代方法是为 `useReducer` 提供一个类型参数

```ts
import { stateReducer, State } from './your-reducer-implementation';
Expand Down

0 comments on commit 69a1e64

Please sign in to comment.