Skip to content

Instantly share code, notes, and snippets.

@nsrau
Last active Aug 26, 2020
Embed
What would you like to do?
var React__default = React;
var PluginOne = function PluginOne(_ref) {
var count = _ref.count,
handlerClick = _ref.handlerClick;
var _useState = React.useState(count),
state = _useState[0],
setState = _useState[1];
return React__default.createElement("div", null, React__default.createElement("h2", null, "Plugin One"), React__default.createElement("hr", null), React__default.createElement("button", {
onClick: function onClick() {
var newCount = state + 1;
handlerClick(newCount);
setState(newCount);
}
}, "count +"), React__default.createElement("button", {
onClick: function onClick() {
var newCount = state - 1;
handlerClick(newCount);
setState(newCount);
}
}, "count -"), React__default.createElement("hr", null), React__default.createElement("h4", null, "plugin one count: ", state));
};
window.PluginOne = PluginOne;
console.log('load from gist')
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment