UNPKG

flowbite-react

Version:

Official React components built for Flowbite and Tailwind CSS

22 lines (18 loc) 540 B
'use client'; 'use strict'; var React = require('react'); const useWatchLocalStorageValue = ({ key: watchKey, onChange }) => { function handleStorageChange({ key, newValue }) { if (key === watchKey) onChange(newValue); } React.useEffect(() => { window.addEventListener("storage", handleStorageChange); return () => window.removeEventListener("storage", handleStorageChange); }, []); }; exports.useWatchLocalStorageValue = useWatchLocalStorageValue; //# sourceMappingURL=use-watch-localstorage-value.cjs.map