"use strict";
var __importDefault = (this && this.__importDefault) || function (mod) {
    return (mod && mod.__esModule) ? mod : { "default": mod };
};
Object.defineProperty(exports, "__esModule", { value: true });
exports.useStyle = void 0;
const react_1 = __importDefault(require("react"));
const lodash_es_1 = require("lodash-es");
function useStyle(style, dom) {
    const styleKeys = react_1.default.useMemo(() => Object.keys(style), [style]);
    react_1.default.useLayoutEffect(() => {
        const cachedStyle = (0, lodash_es_1.pick)(dom.style, styleKeys);
        Object.assign(dom.style, style);
        return () => {
            Object.assign(dom.style, cachedStyle);
        };
    }, [dom, styleKeys, style]);
}
exports.useStyle = useStyle;
//# sourceMappingURL=use-hooks.js.map