本文介绍了immutable.js #get如何工作?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
我知道Map()如何创建一个空的Map对象,但是get
在这里如何工作?这是否意味着它将从active
键中获取值,如果那里没有键,它将创建一个空的Map对象?文档在哪里?
I know how Map() can create an empty Map object, but how does the get
here work?? Does it mean it will get get the value from the active
key and if there isn't a key there, it will create an empty Map object? Where is the docs for this?
const activeSelector = createSelector(
rootSelector,
(root) => root.get('active', Map())
);
推荐答案
是的,这就是它的工作原理.在您的示例中,如果 active 不是键,它将返回一个新的Map.在文档中为 get() 定义>
Yes, that's how it works. In your example, if active is not a key, it will return a new Map. This is defined in the docs for get()
这篇关于immutable.js #get如何工作?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!