Reputation: 3678
http://codepen.io/anon/pen/KaZavV Hi
I am using HOC
using decorator syntax .But it is not working why ? I make three component .But when I used '@' syntax above the component .It show nothing
@D
class A extends React.Component {
render(){
return (
<div>
<button onClick={this.props.update}>increase</button>
<h1>{this.props.count}</h1>
</div>
)
}
}
Upvotes: 0
Views: 68
Reputation: 112867
Decorators are not available in the language, so you need to use Babel.
You could use babel-plugin-transform-decorators-legacy and add it as a plugin to your .babelsrc
file:
{
"plugins": ["transform-decorators-legacy"]
}
Upvotes: 1