Skip to content

Instantly share code, notes, and snippets.

@sajithdilshan
Created January 27, 2018 19:52
Show Gist options
  • Save sajithdilshan/c6790d68b70b20ffae1d2b408eadcc2b to your computer and use it in GitHub Desktop.
Save sajithdilshan/c6790d68b70b20ffae1d2b408eadcc2b to your computer and use it in GitHub Desktop.
import React from "react";
import * as ColorAppActions from "../actions/ColorAppActions";
export default class ButtonComponent extends React.Component {
onButtonClick = (colorName) => {
ColorAppActions.changeColor(colorName)
};
render() {
return (
<div>
<button onClick={() => this.onButtonClick("red")} className="color-button">Red</button>
<button onClick={() => this.onButtonClick("blue")} className="color-button">Blue</button>
</div>
);
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment