Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- function mapStateToProps(state){
- 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);
- 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()
- ]
- };
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement