use-svelte-store
v1.3.3
Published
Consume svelte-stores from react, with hooks
Downloads
4
Readme
use-svelte-store
This is fork of react-use-svelte-store but you don't need svelte in dependency, just do npm install use-svelte-store
, play with example, you can find more details from original project react-use-svelte-store.
How do I get started?
I'm assuming you have react installed. If not, well, figuring that out is on you.
npm install use-svelte-store
- Create a file
stores.ts
. - Create a svelte store:
export const foos = writable<Foo[]>([]);
- Use the store in a component:
const $foos = useReadable(foos);
- Update the store in a component:
foos.update(f => f.concat(new Foo()))