如何阅读 Immutable / React 文档页面上的代码示例
How To Read The Code Sample At Immutable / React Document Pages
其实纠结了几天终于决定问这个问题
Facebook 团队在 React & Immutable pages 上使用这种代码风格。有人可以解释一下如何阅读这些内容吗?
这是链接页面的代码副本:
List.of<T>(...values: T[]): List<T>
我们应该如何阅读这篇文章?
这个 -
List.of<T>(...values: T[]): List<T>
意思是这个-
The function List.of<any type>(takes one or more items of
that type) : and returns a List<of that type>.
他们文档中的另一个例子 -
update(index: number, notSetValue: T, updater: (value: T) => T): List<T>
意思是这个-
The function update(takes index, which is a number, notSetValue which is of any type, and updater which is a function (which takes in value of that type) => and returns that type) and returns a List of that type.
其实纠结了几天终于决定问这个问题
Facebook 团队在 React & Immutable pages 上使用这种代码风格。有人可以解释一下如何阅读这些内容吗?
这是链接页面的代码副本:
List.of<T>(...values: T[]): List<T>
我们应该如何阅读这篇文章?
这个 -
List.of<T>(...values: T[]): List<T>
意思是这个-
The function List.of<any type>(takes one or more items of that type) : and returns a List<of that type>.
他们文档中的另一个例子 -
update(index: number, notSetValue: T, updater: (value: T) => T): List<T>
意思是这个-
The function update(takes index, which is a number, notSetValue which is of any type, and updater which is a function (which takes in value of that type) => and returns that type) and returns a List of that type.