mobx-react 7.0.1 → 7.0.5
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/CHANGELOG.md +37 -0
- package/README.md +5 -6
- package/dist/Provider.d.ts +10 -0
- package/dist/disposeOnUnmount.d.ts +5 -0
- package/dist/index.d.ts +7 -0
- package/dist/index.js +8 -0
- package/dist/inject.d.ts +5 -0
- package/dist/mobxreact.cjs.development.js +840 -0
- package/dist/mobxreact.cjs.development.js.map +1 -0
- package/dist/mobxreact.cjs.production.min.js +2 -0
- package/dist/mobxreact.cjs.production.min.js.map +1 -0
- package/dist/mobxreact.esm.development.js +775 -0
- package/dist/mobxreact.esm.development.js.map +1 -0
- package/dist/mobxreact.esm.js +775 -0
- package/dist/mobxreact.esm.js.map +1 -0
- package/dist/mobxreact.esm.production.min.js +2 -0
- package/dist/mobxreact.esm.production.min.js.map +1 -0
- package/dist/mobxreact.umd.development.js +841 -0
- package/dist/mobxreact.umd.development.js.map +1 -0
- package/dist/mobxreact.umd.production.min.js +2 -0
- package/dist/mobxreact.umd.production.min.js.map +1 -0
- package/dist/observer.d.ts +5 -0
- package/dist/observerClass.d.ts +2 -0
- package/dist/propTypes.d.ts +10 -0
- package/dist/types/IReactComponent.d.ts +2 -0
- package/dist/types/IStoresToProps.d.ts +2 -0
- package/dist/types/IValueMap.d.ts +1 -0
- package/dist/types/IWrappedComponent.d.ts +4 -0
- package/dist/utils/utils.d.ts +15 -0
- package/package.json +6 -6
package/CHANGELOG.md
CHANGED
|
@@ -1,5 +1,42 @@
|
|
|
1
1
|
# mobx-react
|
|
2
2
|
|
|
3
|
+
## 7.0.5
|
|
4
|
+
|
|
5
|
+
### Patch Changes
|
|
6
|
+
|
|
7
|
+
- [`2f3dcb27`](https://github.com/mobxjs/mobx/commit/2f3dcb274f795ffca4ae724b6b4795958620838d) Thanks [@FredyC](https://github.com/FredyC)! - Fix names of UMD exports [#2517](https://github.com/mobxjs/mobx/issues/2617)
|
|
8
|
+
|
|
9
|
+
- Updated dependencies [[`2f3dcb27`](https://github.com/mobxjs/mobx/commit/2f3dcb274f795ffca4ae724b6b4795958620838d), [`79a09f49`](https://github.com/mobxjs/mobx/commit/79a09f49a9f2baddbab8d89e9a7ac07cffadf624)]:
|
|
10
|
+
- mobx-react-lite@3.1.6
|
|
11
|
+
- mobx@6.0.4
|
|
12
|
+
|
|
13
|
+
## 7.0.4
|
|
14
|
+
|
|
15
|
+
### Patch Changes
|
|
16
|
+
|
|
17
|
+
- [`8bbbc7c0`](https://github.com/mobxjs/mobx/commit/8bbbc7c0df77cd79530add5db2d6a04cfe6d84b1) Thanks [@FredyC](https://github.com/FredyC)! - Fix names of dist files (for real now). Third time is the charm 😅
|
|
18
|
+
|
|
19
|
+
- Updated dependencies [[`8bbbc7c0`](https://github.com/mobxjs/mobx/commit/8bbbc7c0df77cd79530add5db2d6a04cfe6d84b1)]:
|
|
20
|
+
- mobx-react-lite@3.1.4
|
|
21
|
+
|
|
22
|
+
## 7.0.3
|
|
23
|
+
|
|
24
|
+
### Patch Changes
|
|
25
|
+
|
|
26
|
+
- [`b7aa9d35`](https://github.com/mobxjs/mobx/commit/b7aa9d35432888ee5dd80a6c9dcbc18b04a0346c) Thanks [@FredyC](https://github.com/FredyC)! - Fixed wrong package name for dist files
|
|
27
|
+
|
|
28
|
+
- Updated dependencies [[`b7aa9d35`](https://github.com/mobxjs/mobx/commit/b7aa9d35432888ee5dd80a6c9dcbc18b04a0346c)]:
|
|
29
|
+
- mobx-react-lite@3.1.3
|
|
30
|
+
|
|
31
|
+
## 7.0.2
|
|
32
|
+
|
|
33
|
+
### Patch Changes
|
|
34
|
+
|
|
35
|
+
- [`5239db80`](https://github.com/mobxjs/mobx/commit/5239db80cf000026906c28a035725933d4dd6823) Thanks [@FredyC](https://github.com/FredyC)! - Fixed release with missing dist files
|
|
36
|
+
|
|
37
|
+
- Updated dependencies [[`5239db80`](https://github.com/mobxjs/mobx/commit/5239db80cf000026906c28a035725933d4dd6823)]:
|
|
38
|
+
- mobx-react-lite@3.1.2
|
|
39
|
+
|
|
3
40
|
## 7.0.1
|
|
4
41
|
|
|
5
42
|
### Patch Changes
|
package/README.md
CHANGED
|
@@ -11,8 +11,7 @@
|
|
|
11
11
|
|
|
12
12
|
Package with React component wrapper for combining React with MobX.
|
|
13
13
|
Exports the `observer` decorator and other utilities.
|
|
14
|
-
For documentation, see the [MobX](https://
|
|
15
|
-
There is also work-in-progress [user guide](https://mobx-react.js.org) for additional information.
|
|
14
|
+
For documentation, see the [MobX](https://mobx.js.org) project.
|
|
16
15
|
This package supports both React and React Native.
|
|
17
16
|
|
|
18
17
|
## Choosing your version
|
|
@@ -25,7 +24,7 @@ There are currently two actively maintained versions of mobx-react:
|
|
|
25
24
|
| v6 | 4._ / 5._ | 16.8+ | Yes |
|
|
26
25
|
| v5 | 4._ / 5._ | 0.13+ | No, but it is possible to use `<Observer>` sections inside hook based components |
|
|
27
26
|
|
|
28
|
-
mobx-react 6 / 7 is a repackage of the smaller [mobx-react-lite](https://github.com/mobxjs/mobx-react-lite) package + following features from the `mobx-react@5` package added:
|
|
27
|
+
mobx-react 6 / 7 is a repackage of the smaller [mobx-react-lite](https://github.com/mobxjs/mobx/tree/main/packages/mobx-react-lite) package + following features from the `mobx-react@5` package added:
|
|
29
28
|
|
|
30
29
|
- Support for class based components for `observer` and `@observer`
|
|
31
30
|
- `Provider / inject` to pass stores around (but consider to use `React.createContext` instead)
|
|
@@ -45,7 +44,7 @@ import { observer } from "mobx-react"
|
|
|
45
44
|
This package provides the bindings for MobX and React.
|
|
46
45
|
See the [official documentation](https://mobx.js.org/react-integration.html) for how to get started.
|
|
47
46
|
|
|
48
|
-
For greenfield projects you might want to consider to use [mobx-react-lite](https://github.com/mobxjs/mobx-react-lite), if you intend to only use function based components. `React.createContext` can be used to pass stores around.
|
|
47
|
+
For greenfield projects you might want to consider to use [mobx-react-lite](https://github.com/mobxjs/mobx/tree/main/packages/mobx-react-lite), if you intend to only use function based components. `React.createContext` can be used to pass stores around.
|
|
49
48
|
|
|
50
49
|
## API documentation
|
|
51
50
|
|
|
@@ -65,7 +64,7 @@ When using component classes, `this.props` and `this.state` will be made observa
|
|
|
65
64
|
|
|
66
65
|
`shouldComponentUpdate` is not supported. As such, it is recommended that class components extend `React.PureComponent`. The `observer` will automatically patch non-pure class components with an internal implementation of `React.PureComponent` if necessary.
|
|
67
66
|
|
|
68
|
-
See the [MobX](https://
|
|
67
|
+
See the [MobX](https://mobx.js.org/react-integration.html#react-integration) documentation for more details.
|
|
69
68
|
|
|
70
69
|
```javascript
|
|
71
70
|
import { observer } from "mobx-react"
|
|
@@ -199,7 +198,7 @@ If you don't want to mark a component as observer, for example to reduce the dep
|
|
|
199
198
|
|
|
200
199
|
### Enabling decorators (optional)
|
|
201
200
|
|
|
202
|
-
Decorators are currently a stage-2 ESNext feature. How to enable them is documented [here](https://
|
|
201
|
+
Decorators are currently a stage-2 ESNext feature. How to enable them is documented [here](https://mobx.js.org/enabling-decorators.html#enabling-decorators-).
|
|
203
202
|
|
|
204
203
|
### Should I still use smart and dumb components?
|
|
205
204
|
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
import React from "react";
|
|
2
|
+
import { IValueMap } from "./types/IValueMap";
|
|
3
|
+
export declare const MobXProviderContext: React.Context<Record<string, any>>;
|
|
4
|
+
export interface ProviderProps extends IValueMap {
|
|
5
|
+
children: React.ReactNode;
|
|
6
|
+
}
|
|
7
|
+
export declare function Provider(props: ProviderProps): JSX.Element;
|
|
8
|
+
export declare namespace Provider {
|
|
9
|
+
var displayName: string;
|
|
10
|
+
}
|
|
@@ -0,0 +1,5 @@
|
|
|
1
|
+
import React from "react";
|
|
2
|
+
declare type Disposer = () => void;
|
|
3
|
+
export declare function disposeOnUnmount(target: React.Component<any, any>, propertyKey: PropertyKey): void;
|
|
4
|
+
export declare function disposeOnUnmount<TF extends Disposer | Array<Disposer>>(target: React.Component<any, any>, fn: TF): TF;
|
|
5
|
+
export {};
|
package/dist/index.d.ts
ADDED
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
export { Observer, useObserver, useAsObservableSource, useLocalStore, isUsingStaticRendering, useStaticRendering, enableStaticRendering, observerBatching, useLocalObservable } from "mobx-react-lite";
|
|
2
|
+
export { observer } from "./observer";
|
|
3
|
+
export { MobXProviderContext, Provider, ProviderProps } from "./Provider";
|
|
4
|
+
export { inject } from "./inject";
|
|
5
|
+
export { disposeOnUnmount } from "./disposeOnUnmount";
|
|
6
|
+
export { PropTypes } from "./propTypes";
|
|
7
|
+
export { IWrappedComponent } from "./types/IWrappedComponent";
|
package/dist/index.js
ADDED
package/dist/inject.d.ts
ADDED
|
@@ -0,0 +1,5 @@
|
|
|
1
|
+
import { IReactComponent } from "./types/IReactComponent";
|
|
2
|
+
import { IWrappedComponent } from "./types/IWrappedComponent";
|
|
3
|
+
import { IStoresToProps } from "./types/IStoresToProps";
|
|
4
|
+
export declare function inject(...stores: Array<string>): <T extends IReactComponent<any>>(target: T) => T & (T extends IReactComponent<infer P> ? IWrappedComponent<P> : never);
|
|
5
|
+
export declare function inject<S, P, I, C>(fn: IStoresToProps<S, P, I, C>): <T extends IReactComponent>(target: T) => T & IWrappedComponent<P>;
|