UNPKG

zent

Version:

一套前端设计语言和基于React的实现

15 lines (14 loc) 471 B
import { useEffect } from 'react'; export function noop() { } export function last(arr) { return arr.length ? arr[arr.length - 1] : null; } export function useDestroyOnUnmount(field, model, parent) { useEffect(function () { return function () { if (typeof field === 'string' && model.destroyOnUnmount) { parent.removeChild(field); model.dispose(); } }; }, [field, model, parent]); } export var isArray = Array.isArray;