Python
Java
PHP
IOS
Android
Nodejs
JavaScript
Html5
Windows
Ubuntu
Linux
如何使用箭头函数(公共类字段)作为类方法?
我是在 React 中使用 ES6 类的新手 之前我一直将我的方法绑定到当前对象 如第一个示例所示 但是 ES6 是否允许我使用箭头将类函数永久绑定到类实例 作为回调函数传递时很有用 当我尝试像使用 CoffeeScript 一样使用它们时
javascript
arrowfunctions
ecmascriptnext
classfields
传递箭头函数与传递函数
假设我有一个函数 handleChange e gt this setState e target id e target value 以下内容有什么区别 1
javascript
ReactJS
arrowfunctions
等待的异步映射函数返回 Promise 而不是 value
我有这个代码 async function addFiles dir tree return await readDir dir map async name gt await readDir dir return name 但不幸的是 它
javascript
asyncawait
babeljs
arrowfunctions
如何在 CoffeeScript 粗箭头回调中引用实际的“this”?
标题说明了一切 当我在 CoffeeScript 中使用粗箭头时 它会存储this首先在调用该函数之前 例如 class myClass constructor gt element id element click gt myMethod
syntax
coffeescript
scope
This
arrowfunctions
ES6/7 中可以导出 Arrow 函数吗?
下面的导出语句出现语法错误 export default const hello gt console log say hello why 我只能导出命名函数 export function hello console log hello
javascript
ECMAScript6
arrowfunctions
Typescript 重载箭头函数
所以我们可以这样做 export function myMethod param number number export function myMethod param string string export function myMe
typescript
overloading
arrowfunctions
绑定与箭头函数(在 JavaScript 中,或用于响应 onClick)
所以我正在努力学习JavaScript and or react理解有点混乱 bind this 在构造函数中 然而 我想现在明白了 只是想知道 为什么有人会使用 Binding 与 Arrow functionJavaScript 或在o
javascript
ReactJS
arrowfunctions
将箭头函数与 jQuery 回调一起使用时,“this”关键字的行为有所不同[重复]
这个问题在这里已经有答案了 我有一个包含多行的表 每行上都有一个edit and delete button 简而言之 当使用 class 触发编辑按钮时 edit 弹出一个表单 除了类名之外 我还添加了一个独特的id like id ed
javascript
arrowfunctions
使用 JavaScript ES6 箭头函数的立即函数
有谁知道如何使用 ES6 箭头语法编写立即函数 这是 ES3 5 的实现方式 function 我已经尝试过以下方法 但得到了unexpected token最后一行错误 gt 你可以在这里测试一下 http www es6fiddle n
javascript
function
ECMAScript6
ecmascriptharmony
arrowfunctions
带表达式的nodejs箭头函数[重复]
这个问题在这里已经有答案了 根据文档 您可以从箭头函数返回一个表达式 param1 param2 paramN gt expression equivalent to gt return expression 但这似乎并没有像我预期的那样工
javascript
nodejs
ECMAScript6
arrowfunctions
我们是否应该在 React 功能组件的每个函数处理程序中使用 useCallback
假设我们有这样的组件 const Example gt const counter setCounter useState 0 const increment gt setCounter counter gt counter 1 retur
javascript
ReactJS
typescript
arrowfunctions
useCallback
打字稿重载箭头功能不起作用
我正在使用严格的空检查 我有以下带有重载类型的箭头函数 type INumberConverter value number number value null null const decimalToPercent INumberConv
typescript
overloading
arrowfunctions
将箭头样式函数转换为“函数”样式
我有一个这样的函数 const jsonObject a b c const x a b const properties x split const item properties reduce obj prop gt obj obj p
javascript
angularJS
ECMAScript6
lodash
arrowfunctions
Angular2订阅理解箭头功能
我尝试通过以下示例来理解打字稿的箭头函数角2可观察的订阅方法 有人能给我解释一下吗 我有这个有效的代码 this readdataservice getPost subscribe posts gt this posts posts 但如果
javascript
angular
typescript
arrowfunctions
JavaScript ES6:测试箭头函数、内置函数、常规函数?
有没有一种优雅的方式来区分 Harmony 的细长箭头函数与常规函数and内置函数 The 和谐维基指出 箭头函数就像内置函数一样缺乏原型以及任何 Construct 内部方法 所以 new gt 会抛出 TypeError 但除此之外箭头
javascript
function
ECMAScript6
ecmascriptharmony
arrowfunctions
JavaScript ecma6 将普通函数更改为箭头函数
我有那个代码 function defineProperty object name callback if object prototype Object defineProperty object prototype name get
javascript
ECMAScript6
arrowfunctions
真的对 javascript es6 箭头函数的“封闭范围”感到困惑
我在网上做了很多研究 阅读了很多帖子 包括MDN等等 据我所知 对于传统定义的函数 函数中的 this 是由调用 调用它们的对象定义的 以及几种不同的情况 对象文字 新的构造函数 事件处理程序等 我知道对于箭头函数 this 是按词法定义的
javascript
ECMAScript6
This
languagedesign
arrowfunctions
我可以在 React 组件的构造函数中使用箭头函数吗?
这个问题类似于使用 React 时 在构造函数中使用粗箭头函数还是绑定函数更可取 但有点不同 您可以将函数绑定到this在构造函数中 或者仅在构造函数中应用箭头函数 请注意 我的项目中只能使用 ES6 语法 1 class Test ext
javascript
ReactJS
constructor
ECMAScript6
arrowfunctions
什么是双箭头函数?
什么是 让x something1 gt something2 gt something3 我有这段代码 但我无法理解它的作用 const myReducers person hoursWorked const combineReducer
javascript
typescript
arrowfunctions
JavaScript 中的“=>”(由等于和大于组成的箭头)是什么意思?
我知道 gt 运算符意味着大于或等于 但我见过 gt 在一些源代码中 那个运算符是什么意思 这是代码 promiseTargetFile fpParams aSkipPrompt relatedURI then aDialogAccepte
javascript
syntax
ECMAScript6
arrowfunctions
«
1
2