Skip to content
This repository has been archived by the owner on Feb 10, 2021. It is now read-only.

React Bindings #3

Open
shadowtime2000 opened this issue Nov 28, 2020 · 2 comments
Open

React Bindings #3

shadowtime2000 opened this issue Nov 28, 2020 · 2 comments
Labels
enhancement New feature or request

Comments

@shadowtime2000
Copy link
Contributor

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>
		</>
	)
}
@shadowtime2000 shadowtime2000 added the enhancement New feature or request label Nov 28, 2020
@aidenybai
Copy link

This could work

@shadowtime2000
Copy link
Contributor Author

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.

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
enhancement New feature or request
Projects
None yet
Development

No branches or pull requests

2 participants