Open shadowtime2000 opened 3 years ago
Possible usage:
import { Atom } from "luciex"; import { useAtom } from "luciex-react"; function Counter({ countAtom }) { const increment = useCallback((num) => num + 1); const [val, dispatch] = useAtom(countAtom); return ( <> <div>Count: {val}</div> <button onClick={() => dispatch(increment)}>Increment!</button> </> ) }
This could work
I could do a fake useAtom where it doesn't link at all to the actual global state and it uses it's own copy, or I could looking into subscribing forced renders.
useAtom
Possible usage: