美文网首页
Pure Fuction 纯函数的定义

Pure Fuction 纯函数的定义

作者: xcyzjs | 来源:发表于2020-09-23 10:53 被阅读0次

Pure Function wiki definition:

In computer programming a pure function is a that has the following properties:

  1. Its return value is the same for the same arguments.
  2. Its evaluation has no side effects.
  1. 同样参数总是返回相同的结果, 也就是函数内部没有随机生成的数
  2. 没有副作用, 指的是不会改变其它的变量的值, 不会有日志记录等

redux 的 reducer 中使用 纯函数, 输入一个 state, 在不改变输入的 state 的情况下, 返回一个 新的 state

相关文章

网友评论

      本文标题:Pure Fuction 纯函数的定义

      本文链接:https://www.haomeiwen.com/subject/ozbnyktx.html