Skip to content

YutaMoriJP/Kantan-Hooks

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

20 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Kantan-Hooks

Kantan-Hooks is a lightweight React Hooks library. The project is still work-in-progress, and the Documentation can be found here.

Get started

Run the following command

npm install kantan-hooks

Or do it with yarn:

yarn add kantan-hooks

Next, import the hook that you need. Learn more in the documentation.

import { useLocalStorage } from "kantan-hooks";

export default function LocalStorage() {
  const [theme, setTheme] = useLocalStorage("dark", "theme");
  const newTheme = theme === "dark" ? "light" : "dark";
  return (
    <div>
      <h1>current theme {theme}</h1>
      <button onClick={() => setTheme(newTheme)}>change Theme</button>
      <button onClick={() => window.location.reload()}>
        Refresh window and check if your state persists!
      </button>
    </div>
  );
}

About

No description, website, or topics provided.

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published