Skip to content

Commit

Permalink
chore: update README.md
Browse files Browse the repository at this point in the history
  • Loading branch information
MatthewPattell committed Apr 19, 2024
1 parent f20c5e1 commit 545e5fe
Showing 1 changed file with 11 additions and 2 deletions.
13 changes: 11 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -342,11 +342,13 @@ const relations = storeManager.getStoresRelations();
/**
* Manually create stores for component
* NOTE: 'withStores' wrapper use this method, probably you won't need it
* WARNING: Avoid using this method directly, it may cause unexpected behavior
*/
const stores = storeManager.createStores(['someStore', MyStore], 'parent-id', 'context-id', 'suspense-id', 'HomePage', { componentProp: 'test' });

/**
* Mount/Unmount simple stores to component
* WARNING: Avoid using this method directly, it may cause unexpected behavior
*/
const unmount = storeManager.mountStores(stores);

Expand Down Expand Up @@ -386,13 +388,20 @@ const storeClass = Manager.persistStore(class MyStore {}, 'my-store');
```typescript
import { withStores } from '@lomray/react-mobx-manager';

const stores = {
myStore: MyStore,
anotherStore: AnotherStore,
// assign static id to future store
demoStore: { store: SomeStore, id: 'my-id' },
// get parent store, do this only inside children components
parentStore: { store: SomeParentStore, isParent: true },
};

/**
* Create and connect 'stores' to component with custom context id
* NOTE: In most cases, you don't need to pass a third argument (contextId).
*/
withStores(Component, stores, { customContextId: 'optional-context-id' });

const stores = { myStore: MyStore, anotherStore: AnotherStore };
```

### StoreManagerProvider
Expand Down

0 comments on commit 545e5fe

Please sign in to comment.