(state = {})=>国家的意思 [英] what does (state = {}) => state means

查看:335
本文介绍了(state = {})=>国家的意思的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

 (state = {})=>状态

任何人都可以向我解释上述意思是什么?
它是 javascript ES6标准。

解决方案

这是一个(n箭头)函数返回其输入。如果输入没有定义,它将成为默认值{}。



您可能已经看到它与使用redux'connect相结合,作为映射的功能该商店的状态用于连接组件的投影。如果没有可用状态,将提供空对象。


I was building an App in react where I found a line in one of the boiler plate projects.

(state = {}) => state

Can anyone explain to me what the above line means? It's javascript ES6 standard.

解决方案

It is a(n arrow) function that returns its input. If the input is not defined it will become the default value {}.

You might have seen it in combination with using redux' "connect", as the function that maps the store's state to the projection used for the connected component. If there is no state available, the empty object will be provided.

这篇关于(state = {})=>国家的意思的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆