Skip to content

Commit

Permalink
Merge bf9228c into 42f8ac0
Browse files Browse the repository at this point in the history
  • Loading branch information
Egor Gorbachev committed Jan 10, 2023
2 parents 42f8ac0 + bf9228c commit 73fc5aa
Showing 1 changed file with 1 addition and 7 deletions.
8 changes: 1 addition & 7 deletions packages/mobx-react/README.md
Expand Up @@ -136,8 +136,6 @@ person.name = "Mike" // will cause the Observer region to re-render

### `useLocalObservable` hook

[User guide](https://mobx-react.js.org/state-local)

Local observable state can be introduced by using the `useLocalObservable` hook, that runs once to create an observable store. A quick example would be:

```javascript
Expand Down Expand Up @@ -218,8 +216,6 @@ Use `import { PropTypes } from "mobx-react"` to import them, then use for exampl

### `Provider` and `inject`

See also [the migration guide to React Hooks](https://mobx-react.js.org/recipes-migration).

_Note: usually there is no need anymore to use `Provider` / `inject` in new code bases; most of its features are now covered by `React.createContext`._

`Provider` is a component that can pass stores (or other stuff) using React's context mechanism to child components.
Expand Down Expand Up @@ -270,7 +266,7 @@ Notes:
#### "The set of provided stores has changed" error

Values provided through `Provider` should be final. Make sure that if you put things in `context` that might change over time, that they are `@observable` or provide some other means to listen to changes, like callbacks. However, if your stores will change over time, like an observable value of another store, MobX will throw an error.
This restriction exists mainly for legacy reasons. If you have a scenario where you need to modify the set of stores, please leave a comment about it in this issue https://github.com/mobxjs/mobx-react/issues/745. Or a preferred way is to [use React Context](https://mobx-react.js.org/recipes-context) directly which does not have this restriction.
This restriction exists mainly for legacy reasons. If you have a scenario where you need to modify the set of stores, please leave a comment about it in this issue https://github.com/mobxjs/mobx-react/issues/745.

#### Inject as function

Expand Down Expand Up @@ -398,8 +394,6 @@ public render() {
}
```

By [migrating to React Hooks](https://mobx-react.js.org/recipes-migration) you can avoid problems with TypeScript.

#### Testing store injection

It is allowed to pass any declared store in directly as a property as well. This makes it easy to set up individual component tests without a provider.
Expand Down

0 comments on commit 73fc5aa

Please sign in to comment.