Update README.md

main
Cherry7 8 months ago committed by GitHub
parent d6803729f1
commit dacdda47c2
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
  1. 21
      README.md

@ -47,3 +47,24 @@ state.count++;
state.$nested.value.deep = 'new value';
state.$array.value.push(4);
```
### watch
```ts
import { deepSignal, watch } from 'alien-deepsignals';
const state = deepSignal({
count: 0,
name: 'John',
nested: {
deep: 'value',
},
array: [1, 2, 3],
});
watch(state,(value)=>{
console.log(value);
},{
deep: true,
immediate: true,
// once
})
```

Loading…
Cancel
Save