我刚开始学习web开发和学习React/Redux,并学习了来自http://teropa.info/blog/2015/09/10/full-stack-redux-tutorial.html的教程。
我试图理解和混淆我们在下面的代码中使用的used ()和skip()方法。我能理解它的用法,但我们从哪里得到的??JS方法?immutable.js方法?我搜索谷歌已经好几个小时了。但没有运气。有人能帮忙吗?谢谢你抽出时间:
import { List, Map } from 'immutable';
export function next(state) {
const entries = state.get('entries');
return state.merge({
vote: Map({ pair: entries.take(2)}),
entries: entries.skip(2)
});
}发布于 2018-05-01 21:07:15
http://facebook.github.io/immutable-js/docs/#/Map/take
http://facebook.github.io/immutable-js/docs/#/Map/skip
take()返回相同类型的新集合,其中包含此集合中的第一个金额项。
示例:take(amount: number): this
skip()返回相同类型的新集合,该集合将该集合中的第一个金额项排除在外。
示例:skip(amount: number): this
这是来自不可变的js映射函数。
https://stackoverflow.com/questions/50123794
复制相似问题