Skip to content

Instantly share code, notes, and snippets.

@nsrau
Last active August 26, 2020 13:19
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save nsrau/5e9e6961ac11d8cefe3cd401d48ba6d7 to your computer and use it in GitHub Desktop.
Save nsrau/5e9e6961ac11d8cefe3cd401d48ba6d7 to your computer and use it in GitHub Desktop.
function _interopDefault (ex) { return (ex && (typeof ex === 'object') && 'default' in ex) ? ex['default'] : ex; }
var React__default = _interopDefault(React);
var PluginTwo = function PluginTwo(_ref) {
var count = _ref.count,
handlerClick = _ref.handlerClick;
var _useState = React.useState(count),
state = _useState[0],
setState = _useState[1];
return React__default.createElement("div", {
style: {
background: 'red',
color: 'white'
}
}, React__default.createElement("h2", null, "Plugin Two"), 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 two count: ", state));
};
window.PluginTwo = PluginTwo;
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment