@sample-stack/counter-module-browser
Version:
Sample core for higher packages to depend on
27 lines (26 loc) • 1 kB
JavaScript
import {jsxs,jsx}from'@emotion/react/jsx-runtime';import {connect,useDispatch}from'react-redux';import {LOCATION_CHANGE}from'@common-stack/remix-router-redux';import {increment,decrement}from'../redux/index.js';const CounterComponent = props => {
const dispatch = useDispatch();
return jsxs("div", {
children: [`Counter: ${props.count}`, jsx("button", {
onClick: () => dispatch({
type: LOCATION_CHANGE,
payload: {}
}),
children: "ROUTER"
}), jsx("button", {
onClick: props.increment,
children: "+"
}), jsx("button", {
onClick: props.decrement,
children: "-"
})]
});
};
const mapStateToProps = state => ({
count: state.connectedReactRouterCounter
});
const mapDispatchToProps = dispatch => ({
increment: () => dispatch(increment()),
decrement: () => dispatch(decrement())
});
var Counter = connect(mapStateToProps, mapDispatchToProps)(CounterComponent);export{Counter as default};//# sourceMappingURL=Counter.js.map