import React, {Component} from 'react'; import classnames from 'classnames'; import styles from './Button.scss'; let cx = classnames.bind(styles); export default class Button extends Component { constructor(props) { super(props); this.state = {active: false}; } componentDidMount() { this.setState({change: this.props.change}); console.log(this.props.change); } click() { this.setState({'active': !this.state.active}); this.state.change(this.props.name, this.state.active); console.log(this.state); } render() { let classes = cx('Specialbutton', {active: this.state.active}); return <button className={classes} onClick={this.click.bind(this)}>{this.props.name}</button>; } }
import React from 'react' import ReactDom from 'react-dom' import { RaisedButton } from 'material-ui' import { browserHistory } from 'react-router' import CSSModules from 'react-css-modules' import styles from './GameItem.css' import AnimationMixin from '~/app/mixins/AnimationMixin' import * as api from '~/app/api' import classNames from 'classnames' classNames.bind(styles) let GameItem = React.createClass({ mixins: [AnimationMixin], componentDidUpdate(prevProps, prevState) { if (this.props.updated) { this.animateUpdate(ReactDom.findDOMNode(this.refs.row)) } }, componentDidMount() { this.animateAppear(ReactDom.findDOMNode(this.refs.row)) }, handleRowTap() { if (!this.props.currentPresent) { this.props.enterGame(this.props.game.id) } },