Skip to content

Instantly share code, notes, and snippets.

@astrarudra
Created May 25, 2024 13:54
Show Gist options
  • Save astrarudra/556f199687334a69d43eb5576d6ebd49 to your computer and use it in GitHub Desktop.
Save astrarudra/556f199687334a69d43eb5576d6ebd49 to your computer and use it in GitHub Desktop.
Zustand Controller - The UI
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