@lomray/react-mobx-manager 3.1.1-beta.1 → 3.1.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +11 -2
- package/package.json +1 -1
package/README.md
CHANGED
|
@@ -342,11 +342,13 @@ const relations = storeManager.getStoresRelations();
|
|
|
342
342
|
/**
|
|
343
343
|
* Manually create stores for component
|
|
344
344
|
* NOTE: 'withStores' wrapper use this method, probably you won't need it
|
|
345
|
+
* WARNING: Avoid using this method directly, it may cause unexpected behavior
|
|
345
346
|
*/
|
|
346
347
|
const stores = storeManager.createStores(['someStore', MyStore], 'parent-id', 'context-id', 'suspense-id', 'HomePage', { componentProp: 'test' });
|
|
347
348
|
|
|
348
349
|
/**
|
|
349
350
|
* Mount/Unmount simple stores to component
|
|
351
|
+
* WARNING: Avoid using this method directly, it may cause unexpected behavior
|
|
350
352
|
*/
|
|
351
353
|
const unmount = storeManager.mountStores(stores);
|
|
352
354
|
|
|
@@ -386,13 +388,20 @@ const storeClass = Manager.persistStore(class MyStore {}, 'my-store');
|
|
|
386
388
|
```typescript
|
|
387
389
|
import { withStores } from '@lomray/react-mobx-manager';
|
|
388
390
|
|
|
391
|
+
const stores = {
|
|
392
|
+
myStore: MyStore,
|
|
393
|
+
anotherStore: AnotherStore,
|
|
394
|
+
// assign static id to future store
|
|
395
|
+
demoStore: { store: SomeStore, id: 'my-id' },
|
|
396
|
+
// get parent store, do this only inside children components
|
|
397
|
+
parentStore: { store: SomeParentStore, isParent: true },
|
|
398
|
+
};
|
|
399
|
+
|
|
389
400
|
/**
|
|
390
401
|
* Create and connect 'stores' to component with custom context id
|
|
391
402
|
* NOTE: In most cases, you don't need to pass a third argument (contextId).
|
|
392
403
|
*/
|
|
393
404
|
withStores(Component, stores, { customContextId: 'optional-context-id' });
|
|
394
|
-
|
|
395
|
-
const stores = { myStore: MyStore, anotherStore: AnotherStore };
|
|
396
405
|
```
|
|
397
406
|
|
|
398
407
|
### StoreManagerProvider
|