Skip to main content

实用功能

¥Utility Functions

Redux 核心导出额外的实用函数以供重用。

¥The Redux core exports additional utility functions for reuse.

isAction

如果参数是有效的 Redux 操作对象(带有字符串 type 字段的普通对象),则返回 true。

¥Returns true if the parameter is a valid Redux action object (a plain object with a string type field).

这也用作 TypeScript 类型谓词,它将 TS 类型缩小到 Action<string>

¥This also serves as a TypeScript type predicate, which will narrow the TS type to Action<string>.

isPlainObject

如果该值看起来是一个普通的 JS 对象,则返回 true。

¥Returns true if the value appears to be a plain JS object.