Created
May 25, 2024 13:54
-
-
Save astrarudra/556f199687334a69d43eb5576d6ebd49 to your computer and use it in GitHub Desktop.
Zustand Controller - The UI
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import { useOxyStore, OxyController } from | |
"src/shared-state" | |
import { Button , ControllerCard } from | |
'../UIElements' | |
export const ControllerTriggerButton = () => ( | |
<Button onClick={() => OxyController.demo()}> | |
Run Controller | |
</Button> | |
) // It will trigger the controller. | |
export const ConnectedComponent = () => { | |
const [demoData] = useOxyStore(s => [s.demoData]) | |
return <div> {demoData} </div> | |
} // It is listening to change in store. |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment