UNPKG

@wordpress/block-editor

Version:
16 lines (15 loc) 392 B
// packages/block-editor/src/hooks/use-cached-truthy.js import { useState, useEffect } from "@wordpress/element"; function useCachedTruthy(value) { const [cachedValue, setCachedValue] = useState(value); useEffect(() => { if (value) { setCachedValue(value); } }, [value]); return cachedValue; } export { useCachedTruthy }; //# sourceMappingURL=use-cached-truthy.js.map