useStorage

Syncs state to local or session storage.


import { useStorage } from 'primereact/hooks';
         

Refresh to page to view the persisted value.


const [count, setCount] = useLocalStorage(0, 'count');
         

Close the browser and visit this page again to view the persisted value.


const [count, setCount] = useSessionStorage(0, 'count');