@satha/react-hooks
v2.0.1
Published
React hooks for satha
Downloads
3
Readme
satha-react-hooks
React hooks for satha (https://satha.netlify.app/)
install satha and satha-react-hooks
// npm
npm i @satha/core @satha/react-hooks
// pnpm
pnpm add @satha/core @satha/react-hooks
useSatha
hook
import { useSatha } from "@satha/react-hooks";
Example:
import React from "react";
import { useStorage } from "@satha/core";
import { useSatha } from "@satha/react-hooks";
const App = () => {
const numbersStore = useStorage("number", 0);
const [value, setValue] = useSatha(numbersStore);
const handleAddOne = () => {
setValue((state) => state + 1);
};
return (
<div>
<button onClick={handleAddOne}>Add</button>
<section>{value}</section>
</div>
);
};
export default App;