@wordpress/data
Version:
Data module for WordPress.
18 lines (17 loc) • 720 B
JavaScript
// packages/data/src/components/with-dispatch/index.js
import { createHigherOrderComponent } from "@wordpress/compose";
import { useDispatchWithMap } from "../use-dispatch";
import { jsx } from "react/jsx-runtime";
var withDispatch = (mapDispatchToProps) => createHigherOrderComponent(
(WrappedComponent) => (ownProps) => {
const mapDispatch = (dispatch, registry) => mapDispatchToProps(dispatch, ownProps, registry);
const dispatchProps = useDispatchWithMap(mapDispatch, []);
return /* @__PURE__ */ jsx(WrappedComponent, { ...ownProps, ...dispatchProps });
},
"withDispatch"
);
var with_dispatch_default = withDispatch;
export {
with_dispatch_default as default
};
//# sourceMappingURL=index.js.map