javascript - function[(thisArg)]) 语法是什么意思?

标签 javascript reactjs

我正在浏览 React documentation当他们同时将函数参数包装到方括号和圆括号中时,对他们在这里试图说的内容感到有点困惑 React.Children.map(children, function[(thisArg)]) function[ (thisArg)]。谁能解释一下是什么意思?

最佳答案

meant这意味着 .map 接受可选的第三个参数,即 thisArg 来调用传递的函数。但是文档中给出的语法非常困惑。换一种更标准的方式,它将是:

React.Children.map(children, functionToInvoke[, thisArg])

React.Children.map(children, function(child, index)[, thisArg])

这是怎么回事MDN does it , 将可选参数放在方括号中所需参数陈述之后。

关于javascript - function[(thisArg)]) 语法是什么意思?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/58210254/

相关文章:

javascript - Prettier 删除数学表达式周围的括号

javascript - 使 sails.js 水线大小写敏感

javascript - 当下拉菜单为空时将 btn 颜色更改回原始颜色

javascript - 如何在 Electron 中使用 node-pty 正确启动 shell 环境?

javascript - 处理 React 和 material-ui 中菜单项列表的点击

javascript - 设置状态不工作

javascript - Sencha Touch 2 - 将轮播添加到面板

commonjs - 有没有办法在原生 CommonJS 环境中使用 JSX?

node.js - GraphQL - POST 正文丢失。你忘记使用 body-parser 中间件了吗?

javascript - 在IE11上显示黑屏的Create-React-App。错误: SCRIPT5009: 'WebSocket' is undefined and SCRIPT5009: 'Promise' is undefined