我正在查看一些ES6代码,我不明白@符号放在变量前面时的作用.我能找到最接近的东西与私人田地有关?
代码我从redux库中查看:
import React, { Component } from 'react';
import { bindActionCreators } from 'redux';
import { connect } from 'redux/react';
import Counter from '../components/Counter';
import * as CounterActions from '../actions/CounterActions';
@connect(state => ({
counter: state.counter
}))
export default class CounterApp extends Component {
render() {
const { counter, dispatch } = this.props;
return (
<Counter counter={counter}
{...bindActionCreators(CounterActions, dispatch)} />
);
}
}
Run Code Online (Sandbox Code Playgroud)
这是我发现的关于这个主题的博客文章:https://github.com/zenparsing/es-private-fields
在这个博客文章中,所有示例都在一个类的上下文中 - 在模块中使用符号时它意味着什么?