luciex
luciex copied to clipboard
React Bindings
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.