I use webpack to build the project. Configuration here:
'use strict'; const NODE_ENV = process.env.NODE_ENV || "development"; const webpack = require('webpack'); module.exports = { context: __dirname + '/src', entry: { main: "./main", common: "./common" }, output: { path: __dirname + (NODE_ENV == "development" ? "/www/js-dev/" : "/www/js/"), filename: "[name].js" }, module: { loaders: [ { test: /\.(js|jsx)?$/, exclude: /node_modules/, loader: 'babel', query: { presets: ["es2015", "react"] } } ] }, watch: NODE_ENV == "development", devtool: NODE_ENV == "development" ? "source-map" : null, plugins: [ new webpack.NoErrorsPlugin(), new webpack.DefinePlugin({ NODE_ENV: JSON.stringify(NODE_ENV), LANG: JSON.stringify("en") }), new webpack.optimize.CommonsChunkPlugin({ name: "common", minChunks: 2 }) ], resolve: { modulesDirectories: ['node_modules'], extensions: ['', '.js'] } }; if (NODE_ENV == "production") { module.exports.plugins.push( new webpack.optimize.UglifyJsPlugin({ compress: { warnings: false, drop_console: true } }) ); } In this case, the error causes the following syntax:
class Footer extends React.Component { //... handleChange = (event, index, value) => this.setState({value}); //... } What to do so that everything is generated normally?
This error code does not cause, but does not work:
class Footer extends React.Component { //... handleChange (event, index, value) { this.setState({value}); } //... }
this.state = {value: 'someValue'};. And how do you try to callhandleChange? - Vasily Barbashevbabelfor its work. I use thestage-1+ plugin for decorators. But earlier it caused a mistake to me, now it isn’t, but it doesn’t work either)) - Vasily Barbashev