Warning: file_get_contents(/data/phpspider/zhask/data//catemap/3/reactjs/21.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Javascript 在React JS中,此关键字之前的::是什么?_Javascript_Reactjs - Fatal编程技术网

Javascript 在React JS中,此关键字之前的::是什么?

Javascript 在React JS中,此关键字之前的::是什么?,javascript,reactjs,Javascript,Reactjs,我在一些react js库中看到如下语法。这是什么意思?如何帮助我的代码 const inputAttributes = { id: 'events-playground', placeholder: 'Where are you now?', onChange: ::this.onInputChanged, onBlur: ::this.onInputBlurred }; 谢谢。这是新的ES7语法 ES5中的等效值 const inputAttributes = { id

我在一些react js库中看到如下语法。这是什么意思?如何帮助我的代码

const inputAttributes = {
  id: 'events-playground',
  placeholder: 'Where are you now?',
  onChange: ::this.onInputChanged,
  onBlur: ::this.onInputBlurred
};
谢谢。

这是新的ES7语法

ES5中的等效值

const inputAttributes = {
  id: 'events-playground',
  placeholder: 'Where are you now?',
  onChange: this.onInputChanged.bind(this),
  onBlur: this.onInputBlurred.bind(this)
};

谢谢我可以在我的react代码中使用它吗,或者使用中存在限制?您可以链接到相关文档吗