diff --git a/examples/counter/src/components/Counter.tsx b/examples/counter/src/components/Counter.tsx
index 98bc8fc..5cc7e45 100644
--- a/examples/counter/src/components/Counter.tsx
+++ b/examples/counter/src/components/Counter.tsx
@@ -1,5 +1,10 @@
import './Counter.css';
-import { defineStore, InjectFlags, provideState } from 'statebuilder';
+import {
+ defineSignal,
+ defineStore,
+ provideState,
+ StateProvider,
+} from 'statebuilder';
import { withProxyCommands } from 'statebuilder/commands';
import { withReduxDevtools } from 'statebuilder/devtools';
import { withAsyncAction } from 'statebuilder/asyncAction';
@@ -26,6 +31,11 @@ function appReducer(state: AppState, action: AppActions) {
}
}
+const GlobalCount = defineSignal(() => 1).extend((_, context) => {
+ context.hooks.onInit(() => console.log('init count2'));
+ context.hooks.onDestroy(() => console.log('destroy count2'));
+});
+
const CountStore = defineStore(() => ({
count: 0,
}))
@@ -54,11 +64,19 @@ const CountStore = defineStore(() => ({
};
});
-export default function Counter() {
- const store = provideState(CountStore, InjectFlags.global);
+function Counter() {
+ const store = provideState(CountStore);
+ const globalCount = provideState(GlobalCount);
return (
<>
+
+