refun
Version:
A collection of React Hook-enabled functions that compose harmoniously with each other. Similar to `recompose`, but:
17 lines (15 loc) • 515 B
JavaScript
import { useContext } from 'react';
import { UNDEFINED } from 'tsfn';
export var mapDefaultContext = function mapDefaultContext(context) {
return function (props) {
var contextProps = useContext(context);
var mergedProps = Object.assign({}, props); // eslint-disable-next-line guard-for-in
for (var key in contextProps) {
if (props[key] === UNDEFINED) {
mergedProps[key] = contextProps[key];
}
}
return mergedProps;
};
};
//# sourceMappingURL=map-default-context.js.map