reactjs - What does the at symbol (@) do in ES6 javascript? (ECMAScript 2015) -


i'm looking @ es6 code , don't understand @ symbol when placed in front of variable. closest thing find has private fields?

code looking @ redux library:

import react, { component } 'react'; import { bindactioncreators } 'redux'; import { connect } 'redux/react'; import counter '../components/counter'; import * counteractions '../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)} />     );   } } 

here blog post found on topic: https://github.com/zenparsing/es-private-fields

in blog post examples in context of class - mean when symbol used within module?

it's decorator. it's proposal added ecmascript. there multiple es6 , es5 equivalent examples on: https://github.com/wycats/javascript-decorators

decorators dynamically alter functionality of function, method, or class without having directly use subclasses or change source code of function being decorated.

they commonly used control access, registration, annotation.


Comments

Popular posts from this blog

ubuntu - PHP script to find files of certain extensions in a directory, returns populated array when run in browser, but empty array when run from terminal -

php - How can i create a user dashboard -

javascript - How to detect toggling of the fullscreen-toolbar in jQuery Mobile? -