Skip to content

Instantly share code, notes, and snippets.

@nsrau
Last active Aug 26, 2020
Embed
What would you like to do?
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