Skip to content

Commit f08138e

Browse files
author
chungheon_yi
committed
docs: update readme
1 parent 46f5851 commit f08138e

File tree

1 file changed

+16
-3
lines changed

1 file changed

+16
-3
lines changed

README.md

Lines changed: 16 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -224,7 +224,8 @@ function createNamespaceContext<
224224
}>;
225225
readonly store: StoreType | undefined;
226226
readonly useNamespaceStores: () => { state: State };
227-
readonly useNamespaceAction: () => StoreType;
227+
readonly useNamespaceAction: () => StoreType; // context functions
228+
readonly useNamespaceContext: () => StoreType // "context"
228229
};
229230
```
230231

@@ -336,13 +337,13 @@ class Text extends NamespaceStore<{ text: string }> {
336337
}
337338

338339
const [createDialogContext, createDialogScope] = createNamespaceScope('Dialog')
339-
const [DialogProvider, useDialogNamespaceStore] = createDialogContext('Dialog', {
340+
const { Provider: DialogProvider, useNamespaceStores: useDialogNamespaceStore } = createDialogContext('Dialog', {
340341
localStore: () => new Counter(),
341342
})
342343

343344
const [createAlertDialogProvider, createAlertDialogScope] = createNamespaceScope('AlertDialog', [createDialogScope])
344345

345-
const [AlertDialogProvider, useAlertDialogNamespaceStore] = createAlertDialogProvider('AlertDialog', {
346+
const { Provider: AlertDialogProvider, useNamespaceStores: useAlertDialogNamespaceStore } = createAlertDialogProvider('AlertDialog', {
346347
localStore: () => new Text(),
347348
})
348349

@@ -507,6 +508,18 @@ const TestComponent = () => {
507508
}
508509
```
509510

511+
### use "Context" value
512+
513+
you can use literally "context" class instance via useNamespaceContext
514+
515+
```jsx
516+
517+
const TestComponent = () => {
518+
const context = useNamespaceContext()
519+
...
520+
}
521+
```
522+
510523
## License
511524

512525
MIT License

0 commit comments

Comments
 (0)