UNPKG

@hanxx/vue-hooks

Version:
12 lines (11 loc) 361 B
"use strict"; Object.defineProperty(exports, "__esModule", { value: true }); var composition_api_1 = require("@vue/composition-api"); function usePrevious(state) { var previous = composition_api_1.ref(); composition_api_1.watch(state, function (_, oldVal) { previous.value = oldVal; }); return previous; } exports.default = usePrevious;