Skip to content

craftystudio/useSavedState

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

2 Commits
 
 
 
 

Repository files navigation

Usage example

import React from "react"
import useSavedState from "./useSavedState"

const AnnoyingPopUp = () => {
    const [isShown, setIsShown] = useSavedState(true)
    const hide = () => setIsShown(false)
  
    return (
        <>
            {isShown && 
                <>
                    <p>This is modal</p>
                    <button onClick={hide}>Close modal</button>
                </>
            }
        </>
    )
}
  
export default AnnoyingPopUp

About

Save react state to localStorage

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published