import { c } from "atomico";
import { useStore } from "@atomico/store";
import { MyStore } from "./my-store";
export const MyApp = c(() => {
const store = useStore(MyStore);
return (
<host>
<button onclick={() => store.counter++}>
Increment: {store.counter}
</button>
</host>
);
});
Bidirectional State Management?
If you're familiar with the Atomico context API, you'll know it's unidirectional, meaning the parent dispatches updates to the child. @atomico/store is bidirectional, allowing any store consumer to synchronize. This means the parent can dispatch updates to the child, and the child can dispatch updates to the parent.