I'm trying to do something really simple: Each time you click a button the value of 'current' in this component: https://github.com/conorhastings/react-thermometer increases.
The problem is that when I build, the console throws the following error: Module build failed: SyntaxError: Unexpected token, expected ( (29:11)
in this line:
function mapStateToProps(state){
Here's the entire code of my container:
import React, {Component} from 'react';
import Thermometer from "react-thermometer";
import {bindActionCreators} from 'redux';
import {connect} from 'react-redux';
import {incrementValue} from '../actions/index';
class Thermo extends Component{
getValue(){
return this.props.val;
}
render(){
return(
<div>
<Thermometer
min={0}
max={90}
width={10}
height={90}
backgroundColor={'gray'}
fillColor={'pink'}
current={this.getValue()}
/>
<Button onClick={() => this.props.incrementValue(val)}>+</Button>
</div>
)
}
function mapStateToProps(state){
return{
val: state.val
};
}
function matchDispatchToProps(dispatch){
return bindActionCreators({incrementValue: incrementValue}, dispatch);
}
}
export default connect(mapStateToProps, matchDispatchToProps)(Thermo);
And just in case, this is my webpack config:
var path = require('path');
var webpack = require('webpack');
module.exports = {
devServer: {
inline: true,
contentBase: './src',
port: 3000
},
devtool: 'cheap-module-eval-source-map',
entry: './dev/js/index.js',
module: {
loaders: [
{
test: /\.js$/,
loaders: ['babel'],
exclude: /node_modules/
},
{
test: /\.scss/,
loader: 'style-loader!css-loader!sass-loader'
}
]
},
output: {
path: 'src',
filename: 'js/bundle.min.js'
},
plugins: [
new webpack.optimize.OccurrenceOrderPlugin()
]
};