看一下React.Children.map代码,看起来这个函数最多需要3个args。
用于React.Children.map的api文档显示
React.Children.map(children, function[(thisArg)])
如果可以用3个args,我希望在那里的某个地方能看到两个逗号。
我的问题是
你如何用通俗易懂的英语阅读React.Children.map(children, function[(thisArg)])
?
到目前为止,我有"React.Children.map是一个函数.“
发布于 2018-11-10 11:45:37
function[(thisArg)]
不是标准的表示法。如文献资料所述,map
将此设置为thisArg的子级中包含的每个直接子元素调用一个函数。
Children.map
签名类似于JavaScript Array.prototype.map
。有3个参数,如果需要,第3个参数是回调函数的可选this
上下文。
Children.map
在源代码中有更好的文档
/**
* Maps children that are typically specified as `props.children`.
*
* See https://reactjs.org/docs/react-api.html#reactchildrenmap
*
* The provided mapFunction(child, key, index) will be called for each
* leaf child.
*
* @param {?*} children Children tree container.
* @param {function(*, int)} func The map function.
* @param {*} context Context for mapFunction.
* @return {object} Object containing the ordered map of results.
*/
function mapChildren(children, func, context) {...}
https://stackoverflow.com/questions/53242398
复制