Attempting to utilize decorators on classes in React with babelify. Despite having the 'es7.decorators' option enabled in Babel, encountering an 'unexpected token' error when using the '@' symbol.
Looking for some insights or solutions. See a basic example below.
Decorator:
export default function(Component) {
return class extends Component {
constructor() {...}
}
}
Class:
import myDecorator from 'decorator';
@myDecorator
class MyClass{...}
Using babelify (Browserify transform for Babel):
browserify().transform(babelify.configure({
optional: ['es7.decorators']
})