UNPKG

26.9 kBMarkdownView Raw
1# MobX-React Changelog
2
3### 6.1.2
4
5- Add reexport of `useObserver` from `mobx-react-lite` [#734](https://github.com/mobxjs/mobx-react/issues/734)
6- Add the ability to pass multiple children to Provider
7- Fixed [#717](https://github.com/mobxjs/mobx-react/issues/717). Now `inject` works correctly with components that use `React.forwardRef`
8- Observer checks for use of React.memo [#720](https://github.com/mobxjs/mobx-react/issues/720)
9- Get rid of the redundant Injector wrapper [#716](https://github.com/mobxjs/mobx-react/pull/716)
10
11### 6.1.1
12
13- Fixed issue where combining `@disposeOnUnmount` with `disposeOnUnmount` didn't clean up everything. Fixes [#666](https://github.com/mobxjs/mobx-react/issues/666) trough [#671](https://github.com/mobxjs/mobx-react/pull/671) by [@JabX](https://github.com/JabX)
14
15### 6.1.0
16
17- Restored the classic implementation of `observer`: class based components are patched again, rather than wrapping them in `<Observer>`, see [#703](https://github.com/mobxjs/mobx-react/pull/703). Fixes:
18 - `componentDidUpdate` not being triggered after a reactive render [#692](https://github.com/mobxjs/mobx-react/issues/692)
19 - The appearance of an additional `<Observer>` component in the component tree, which complicates shallow testing [#699](https://github.com/mobxjs/mobx-react/issues/699)
20 - Some regressions in `disposeOnUnmount` [#702](https://github.com/mobxjs/mobx-react/issues/702)
21 - Note that dev tool support, and other constraints mentioned in the 6.0.0 release notes have not been restored.
22- The function `useStaticRendering(value: boolean): void` from mobx-react-lite is now exposed
23
24### 6.0.4
25
26- Fixed IE 11 compatibility which was accidentally broken. Fixes [#698](https://github.com/mobxjs/mobx-react/issues/698)
27
28### 6.0.3
29
30- `disposeOnUnmount` now supports initializing it with an array of disposers. Fixes [#637](https://github.com/mobxjs/mobx-react/pull/637) through [#641](https://github.com/mobxjs/mobx-react/pull/641) by [@Amareis](https://github.com/Amareis)
31- Fixed hoisting of statically declared members. Fixes [#678](https://github.com/mobxjs/mobx-react/issues/678) through [#682](https://github.com/mobxjs/mobx-react/pull/682) by [@meabed](https://github.com/meabed)
32
33### 6.0.2
34
35- Added missing types for `MobXProviderContext`, `useLocalStore` and `useAsObservableSource`. Fixes #679.
36
37### 6.0.0
38
39**Breaking changes**
40
41- The minimal supported version of React is 16.8.0
42- Killed the possibility to directly pass store names to `observer`. Always use `inject` instead. (This was deprecated for a long time already). `observer(["a", "b"], component)` should now be written as `inject("a", "b")(component)`.
43- `observer` components no longer automatically recover from errors (to prevent potential memory leaks). Instead, this is the responsibility of error boundaries.
44- `inject` now supports ref forwarding. As such, the `.wrappedInstance` property has been removed since refs can be used instead. (Fixes [#616](https://github.com/mobxjs/mobx-react/issues/616) (See also [#619](https://github.com/mobxjs/mobx-react/pull/619) by [42shadow42](https://github.com/42shadow42))
45- Changing the set of stores in `Provider` is no longer supported and while throw a hard error (this was a warning before), as the model of `Provider` / `inject` has always been designed to inject final values into the tree. (That is, constanted references, the injected objects themselves can be stateful without problem). If you want to dynamically swap what is provided into the tree, use `React.createContext` instead of `Provider` / `inject`. The suppressChangedStoreWarning`flag for`Provider` has been dropped.
46- The third argument of custom `storesToProps` functions passed to `inject` is no longer available.
47- `<Observer>` no longer supports the deprecated `inject` property.
48- Defining `shouldComponentUpdate` on `observer` based components is no longer supported
49- `propTypes` is no longer exposed, use `PropTypes` instead
50- `disposeOnUnmount` now only supports direct subclasses of `React.Component` and `React.PureComponent`. This prevents several unreliable edge cases that silently leaked memory before. Either only extend React.(Pure)Component when using `disposeOnUnmount`, or manually clean up stuff in `componentWillUnmount`.
51- The `onError` global error handler has been removed. Use error boundaries instead.
52- Improved dev tool names for `inject` wrapped components, see [#472](https://github.com/mobxjs/mobx-react/pull/472) by [SimeonC](https://github.com/SimeonC). Fixes [#466](https://github.com/mobxjs/mobx-react/issues/466)
53- Dropped support for a build of mobx-react that doesn't target either `react-dom` or `react-native`. mobx-react doesn't need `react-dom` to be present, but to make sure your build tools don't fail, you might want to stub `react-dom` as an empty module.
54- The `componentWillReact` has been dropped
55- The MobX-react devtools (either as package or browser plugin) are no longer supported. Instead, the following tools can be analyzed to analyze your mobx-react application:
56 - Visualizing re-rendering of components is now part of the standard React devtools
57 - The dependency tree of a compent tree can be inspected by showing the state of the `useObserver` hook in the React devtools (at the time of this release it displays as just `Object`, but the next iteration of the React devtools will support those properly)
58 - Spying on events can still be done with the [MobX-react browser plugin](https://github.com/mobxjs/mobx-devtools), through the [mobx-logger](https://github.com/winterbe/mobx-logger) package or manually by using the `spy` or `trace` utility from the mobx package.
59
60**Improvements**
61
62- Hook based components are now supported by mobx-react (in fact, the package is now implemented using hooks)
63- Using `PureComponent` is now _recommended_.
64- For `observer` based components, there will now be an additional `Observer` component in the tree.
65- Two new hooks have been exposed, in case you want to manage local state in observable: `useLocalStore` and `useAsObservableSource`.
66- `MobXProviderContext` is now exposed from the package, in case you want to consume the context used by `Provider` with a `useContext` hook.
67
68### 5.4.3
69
70- Fixed [#612](https://github.com/mobxjs/mobx-react/issues/612), `contextType` was hoisted by `inject`, which shouldn't the case.
71
72### 5.4.1 / 5.4.2
73
74- Fixed issue where `react-is` wasn't properly rolled-up into the package. Fixes [#608](https://github.com/mobxjs/mobx-react/issues/608)
75
76### 5.4.0
77
78- Added support for forward refs, fixes [#602](https://github.com/mobxjs/mobx-react/issues/602)
79
80### 5.3.6
81
82- Fixed some additional issues around life-cycle patching, take 3. See [#536](https://github.com/mobxjs/mobx-react/pull/586) by [@xaviergonz](https://github.com/xaviergonz). Fixed [#579](https://github.com/mobxjs/mobx-react/issues/579)
83
84### 5.3.5
85
86- Fixed some additional issues around life-cycle patching, see [#583](https://github.com/mobxjs/mobx-react/pull/583) by [@xaviergonz](https://github.com/xaviergonz). Fixed [#581](https://github.com/mobxjs/mobx-react/issues/581)
87
88### 5.3.4
89
90- Fixed unending recursing as a result of lifecylce patching. Fixes [#579](https://github.com/mobxjs/mobx-react/issues/579) through [#582](https://github.com/mobxjs/mobx-react/pull/582) by [@xaviergonz](https://github.com/xaviergonz)
91
92### 5.3.3
93
94- Fixed `Cannot read property 'forEach' of undefined` exception if `disposeOnUnmount` was called conditionally. [#578](https://github.com/mobxjs/mobx-react/pull/578) by [Jef Hellemans](https://github.com/JefHellemans)
95
96### 5.3.2
97
98- Fixed: "process not defined", [#574](https://github.com/mobxjs/mobx-react/pull/574/) through [#576](https://github.com/mobxjs/mobx-react/pull/576/) by [@xaviergonz](https://github.com/xaviergonz)
99
100### 5.3.0 / 5.3.1
101
102_5.3.0 was retracted as files were not generated correctly during publish_
103
104- Added `disposeOnUnmount` utility / decorator to call disposable properties (reaction, autorun, etc) automatically on `componentWillUnmount`
105- Introduced new method to patch lifecycle methods which should be more compatible with for example arrow functions.
106
107### 5.2.8
108
109- Make sure `mobx-react` doesn't require `Object.assign` polyfill
110
111### 5.2.7
112
113- Fixed issue where React 16.5 printed a warning when using `Provider`, fixes [#545](https://github.com/mobxjs/mobx-react/issues/545)
114
115### 5.2.6
116
117- Fixed bug in defining properties (although the bug had no known observable effect). Fixes [#540](https://github.com/mobxjs/mobx-react/issues/540)
118
119### 5.2.4 / 5.2.5
120
121- Improved compatibility with React-Hot-Loader, see [#522](https://github.com/mobxjs/mobx-react/pull/522) by [theKashey](https://github.com/theKashey). Fixes [#500](https://github.com/mobxjs/mobx-react/issues/500)
122
123### 5.2.3
124
125- Fixed problem with `Symbol` feature detection. By [@Strate](https://github.com/Strate) through [#501](https://github.com/mobxjs/mobx-react/pull/501). Fixes [#498](https://github.com/mobxjs/mobx-react/issues/498) and [#503](https://github.com/mobxjs/mobx-react/issues/503).
126
127### 5.2.2
128
129- Polyfill `Symbol` if it doesn't exist. By [@Strate](https://github.com/Strate) through [#499](https://github.com/mobxjs/mobx-react/pull/499).
130
131### 5.2.1
132
133- Component `props` and `state` properties are now made observable during the instance creation. This restores the behavior from before 5.1.0 where `props` and `state` could safely be observed during mount. Actually it is now possible to do similar things in constructors as well. Fixes [#478](https://github.com/mobxjs/mobx-react/issues/478). Thanks [@Strate](https://github.com/Strate) for the idea and PR! [#496](https://github.com/mobxjs/mobx-react/pull/496).
134
135### 5.2.0
136
137- Added backward compatible support for MobX 5.
138- Fixed components sometimes being displayed as `undefined` in mobx-devtools. See [#470](https://github.com/mobxjs/mobx-react/pull/470) by [@MauricioAndrades](https://github.com/MauricioAndrades)
139- Removed unnecessary warning `@observer` was used both on a sub and super class. See [#492](https://github.com/mobxjs/mobx-react/pull/476) by [@skiritsis](https://github.com/skiritsis). _N.B. putting `@observer` on a super and subclass is still not an supported pattern, use @observer on subclasses only!_
140
141### 5.1.2
142
143- Fixed regression bug in integration with devtools. Fixed through [#465](https://github.com/mobxjs/mobx-react/pull/465) by @le0nik
144
145### 5.1.0
146
147- Added support for React 16.3, including support for the `getDerivedStateFromProps` life-cycle hook. MobX will no longer use `componentWillMount` hook internally, so that it can be used in `StrictMode` react as well. Fixes [#447](https://github.com/mobxjs/mobx-react/issues/447)
148- Static properties of a function component are now automatically hoisted when the component is wrapped by `observer`. Implements [#427](https://github.com/mobxjs/mobx-react/pull/427)
149- Misspelled export `componentByNodeRegistery` is now properly export as `componentByNodeRegistry` as well, please update consumers, the mispelled version will be dropped in the next major. Fixes [#421](https://github.com/mobxjs/mobx-react/issues/421)
150- Deprecated the support for the `inject` property on `Observer`, it is fundamentally broken and should not be used. Use `inject` on the enclosing component instead and grab the necessary stores from the closure. Fixes [#423](https://github.com/mobxjs/mobx-react/issues/423)
151- Added warning about using `observer` on a React.PureComponent, this will become an exception in the next major. Fixes [#309](https://github.com/mobxjs/mobx-react/issues/309)
152- Mobx-react will now print a warning when combining `observer` with a custom `shouldComponentUpdate` implementation. Fixes [#417](https://github.com/mobxjs/mobx-react/issues/417)
153
154### 5.0.0
155
156- Added compatibility with MobX 4.x. This version is not compatible with older Mobx versions
157
158### 4.4.3
159
160- The exposed React Native build now uses commonjs, to prevent the need of further transpilation. Fixes [#428](https://github.com/mobxjs/mobx-react/issues/428)
161
162### 4.4.2
163
164- Fixed issue with mobx-react not compiling on react-native due to the presence of a `.babelrc` file. Fixes [#415](https://github.com/mobxjs/mobx-react/issues/415) by [Ryan Rampersad](https://github.com/ryanmr) through [#416](https://github.com/mobxjs/mobx-react/pull/416)
165
166### 4.4.1
167
168- Fixed syntax error in 4.4.0 that escaped
169
170### 4.4.0
171
172- `Observer` now supports render props, `render` and `inject`. See the updated readme. By [ZiYingMai](https://github.com/Sunshine168) through [#403](https://github.com/mobxjs/mobx-react/pull/403)
173- Fixed: `NaN` is now considered to be equal to `NaN` when doing reconciliation. Fixes [#363](https://github.com/mobxjs/mobx-react/issues/363), by [Andrew Branch](https://github.com/andrewbranch) through [#402](https://github.com/mobxjs/mobx-react/pull/402)
174- Improved typings of `Observer` component, by [Rafał Filipek](https://github.com/RafalFilipek) through [#376](https://github.com/mobxjs/mobx-react/pull/376)
175- Fixed incorrect generation of component name, by [Andy Kogut](https://github.com/andykog) through [#368](https://github.com/mobxjs/mobx-react/pull/368)
176- Lot of internal repo upgrades: Test suite is now in Jest, Prettier is used etc.
177
178### 4.3.5
179
180Fixed some issues with the typescript typings. See for example #353
181
182### 4.3.4
183
184Improved typescript typings, including support for `strict` mode in TS 2.6. Fixes
185
186### 4.3.3
187
188Added support for React 16. (No changes)
189
190### 4.3.2
191
192Killed accidentally exposed default exports.
193
194If you are still using `import mobxReact from "mobx-react"`, use `import * as mobxReact from "mobx-react"`, or better `import { whatYouNeed } from "mobx-react"` instead.
195
196### 4.3.1
197
198### 4.3.0 (unpublished)
199
200Improved module rollup setup, enabling better tree shaking. See #324 / #328
201
202### 4.2.2
203
204- Fixed check for stateless components, by @leader22, see #280
205
206### 4.2.1
207
208_Note: Due to pull / rebase issue the release commit is incorrect. This is the released [commit](https://github.com/mobxjs/mobx-react/commit/f1b3eefc5239cb451b317204fa8aad94b4dcfc2f)_
209
210- Reduced module size by 31% (switched to rollup.js). See #244 by @rossipedia
211- Skip creation of `.wrappedInstance` reference for stateless components. See #254 by @farwayer
212- Introduced global `onError` handler hook to be notified on errors thrown by `@observer` components. See #262 by @andykog
213- Improved typescript typings of the exposed `propTypes`, See #263 by @panjiesw
214
215### 4.2.0
216
217- Same as 4.2.1, but contained build issue and is unpublished
218
219### 4.1.8
220
221- Undid change introduced in 4.1.4 where the lifecycle hooks were protected, as this breaks react-hot-loader.... Fixes #231
222
223### 4.1.7
224
225- Added support for React 15.5 (no deprecation warnings) and 16.0 (no proptypes / createClass), by @andykog, see #238. Fixes #233, #237
226
227### 4.1.5
228
229- Improved typescript typings, fixes #223
230
231### 4.1.4
232
233- Made lifecycle hooks used by mobx-react read-only to make sure they are not accidentally overwritten in component instances. Fixes, #195, #202. Note that they can still be defined, just make sure to define them on the prototype (`componentWillMount() {}`) instead of the instance (`componentWillMount = () => {}`). Which is best practice anyway.
234
235### 4.1.3
236
237- Fixed `ReactDOM.findDOMNode` exception when using react-test-runner, #216
238
239### 4.1.2
240
241- Exceptions caught during render are now rethrown with proper stack, fixes #206
242
243### 4.1.1
244
245- Exposed `wrappedInstance` and `wrappedComponent` in typings
246- Fixed accidental use of `default` import from `mobx` package.
247
248### 4.1.0
249
250- Added support for MobX3. Note that using MobX3 changes the error semantics. If an `observer` component throws, it will no longer crash the app, but just log the exceptions instead.
251
252### 4.0.4
253
254- Introduced `suppressChangedStoreWarning` to optionally supresss change store warnings, by @dropfen, see #182, #183
255
256### 4.0.3
257
258- Fixed issue where userland componentWilMount was run before observer componentWillMount
259
260### 4.0.2
261
262- Fixed order of `inject` overloads, see #169
263- Fixed import of `mobx` when using Webpack without commonjs plugin, see: #168
264
265### 4.0.1
266
267- Improved typings, by @timmolendijk, fixes #164, #166
268- Fixed `inject` signature in readme, by @farwayer
269
270### 4.0.0
271
272#### `observer` now uses shallow comparision for all props _(Breaking change)_
273
274`observer` used to compare all properties shallow in the built-in _shouldComponentUpdate_, except when it received
275non-observable data structures.
276Because mobx-react cannot know whether a non observable has been deeply modified, it took no chances and just re-renders.
277
278However, the downside of this when an unchanged, non-observable object is passed in to an observer component again, it would still cause a re-render.
279Objects such as styling etc. To fix this mobx-react will now always compare all properties in a pure manner.
280In general this should cause no trouble, as typically mutable data in mobx based objects is captured in observable objects, which will still cause components to re-render if needed.
281
282If you need to pass in a deeply modified object and still want to make sure to cause a re-render, either
283
284- make sure the object / array is an observable
285- do not decorate your component with `observer`, but use `Observer` regions instead (see below)
286
287See [#160](https://github.com/mobxjs/mobx-react/issues/160) for more details.
288
289#### `inject(fn)(component)` will now track `fn` as well
290
291`inject(func)` is now reactive as well, that means that transformations in the selector function will be tracked, see [#111](https://github.com/mobxjs/mobx-react/issues/111)
292
293```javascript
294const NameDisplayer = ({ name }) => <h1>{name}</h1>
295
296const UserNameDisplayer = inject(stores => ({
297 name: stores.userStore.name
298}))(NameDisplayer)
299
300const user = mobx.observable({
301 name: "Noa"
302})
303
304const App = () => (
305 <Provider userStore={user}>
306 <UserNameDisplayer />
307 </Provider>
308)
309
310ReactDOM.render(<App />, document.body)
311```
312
313_N.B. note that in this specific case NameDisplayer doesn't have to be an `observer`, as it doesn't receive observables, but just plain data from the transformer function._
314
315#### `this.props` and `this.state` in React components are now observables as well
316
317A common cause of confusion were cases like:
318
319```javascript
320@observer class MyComponent() {
321 @computed upperCaseName() {
322 return this.props.user.name.toUpperCase()
323 }
324
325 render() {
326 return <h1>{this.upperCaseName}</h1>
327 }
328}
329```
330
331This component would re-render if `user.name` was modified, but it would still render the previous user's name if a complete new user was received!
332The reason for that is that in the above example the only observable tracked by the computed value is `user.name`, but not `this.props.user`.
333So a change to the first would be picked up, but a change in `props` itself, assigning a new user, not.
334
335Although this is technically correct, it was a source of confusion.
336For that reason `this.state` and `this.props` are now automatically converted to observables in any `observer` based react component.
337For more details, see [#136](https://github.com/mobxjs/mobx-react/pull/136) by @Strate
338
339#### Better support for Server Side Rendering
340
341Introduced `useStaticRendering(boolean)` to better support server-side rendering scenarios. See [#140](https://github.com/mobxjs/mobx-react/issues/140)
342
343#### Introduced `Observer` as alternative syntax to the `observer` decorator.
344
345_This feature is still experimental and might change in the next minor release, or be deprecated_
346
347Introduced `Observer`. Can be used as alternative to the `observer` decorator. Marks a component region as reactive.
348See the Readme / [#138](https://github.com/mobxjs/mobx-react/issues/138)
349Example:
350
351```javascript
352const UserNameDisplayer = ({ user }) => <Observer>{() => <div>{user.name}</div>}</Observer>
353```
354
355#### Using `observer` to inject stores is deprecated
356
357The fact that `observer` could inject stores as well caused quite some confusion.
358Because in some cases `observer` would return the original component (when not inject), but it would return a HoC when injecting.
359To make this more consistent, you should always use `inject` to inject stores into a component. So use:
360
361```
362@inject("store1", "store2") @observer
363class MyComponent extends React.Component {
364```
365
366or:
367
368```
369const MyComponent = inject("store1", "store2")(observer(props => rendering))
370```
371
372For more info see the related [discussion](https://github.com/mobxjs/mobx-react/commit/666577b41b7af8209839e7b243064a31c9951632#commitcomment-19773706)
373
374#### Other improvements
375
376- If `mobx` and `mobx-react` are used in combination, all reactions are run as part of React's batched updates. This minimizes the work of the reconciler, guarantees optimal rendering order of components (if the rendering was not triggered from within a React event). Tnx @gkaemmer for the suggestion.
377- It is now possible to directly define `propTypes` and `defaultProps` on components wrapped with `inject` (or `observer(["stores"])`) again, see #120, #142. Removed the warnings for this, and instead improved the docs.
378- Clean up data subscriptions if an error is thrown by an `observer` component, see [#134](https://github.com/mobxjs/mobx-react/pull/134) by @andykog
379- export `PropTypes` as well in typescript typings, fixes #153
380- Add react as a peer dependency
381- Added minified browser build: `index.min.js`, fixes #147
382- Generate better component names when using `inject`
383
384---
385
386### 3.5.9
387
388- Print warning when `inject` and `observer` are used in the wrong order, see #146, by @delaetthomas
389
390### 3.5.8
391
392- Fixed issue where `props` where not passed properly to components in very rare cases. Also fixed #115
393
394### 3.5.7
395
396- Bundles are no longer minified, fixes #127
397
398### 3.5.6
399
400- Export `propTypes` as `PropTypes`, like React (@andykog, ##117)
401
402### 3.5.5
403
404- Removed `experimental` status of `inject` / `Provider`. Official feature now.
405- Fixed hot-reloading issue, #101
406
407### 3.5.4
408
409- Introduced `wrappedInstance` by @rossipedia on `inject` decorated HOC's, see https://github.com/mobxjs/mobx-react/pull/90/
410- print warnings when assign values to `propTypes`, `defaultProps`, or `contextTypes` of a HOC. (by @jtraub, see https://github.com/mobxjs/mobx-react/pull/88/)
411- Static properties are now hoisted to HoC components when, #92
412- If `inject` is used incombination with a function, the object return from the function will now be merged into the `nextProps` instead of replacing them, #80
413- Always do propType checking untracked, partially fixes #56, #305
414
415### 3.5.3
416
417- Fixed error `Cannot read property 'renderReporter' of undefined` (#96)
418
419### 3.5.2
420
421- Added propTypes.observableArrayOf and propTypes.arrayOrObservableArrayOf (#91)
422
423### 3.5.1
424
425- Fixed regression #85, changes caused by the constructor results in inconsistent rendering (N.B.: that is un-idiomatic React usage and React will warn about this!)
426
427### 3.5.0
428
429- Introduced `inject("store1", "store2")(component)` as alternative syntax to inject stores. Should address #77, #70
430- Introduced the `wrappedComponent` property on injected higher order components, addresses #70, #72
431- Fixed #76: error when no stores are provided through context
432- Added typings for devTools related features (@benjamingr).
433- Added MobX specific propTypes (@mattruby)
434- Merged #44, fixes #73: don't re-render if component was somehow unmounted
435
436### 3.4.0
437
438- Introduced `Provider` / context support (#53 / MobX #300)
439- Fixed issues when using devtools with IE. #66 (By @pvasek)
440
441### 3.3.1
442
443- Added typescript typings form `mobx-react/native` and `mobx-react/custom`
444- Fixed #63: error when using stateless function components when using babel and typescript
445
446### 3.3.0
447
448- Upgraded to MobX 2.2.0
449
450### 3.2.0
451
452- Added support for react-native 0.25 and higher. By @danieldunderfelt.
453
454### 3.1.0
455
456- Added support for custom renderers (without DOM), use: `mobx-react/custom` as import fixes #42
457- Fixed some issues with rollup #43
458- Minor optimization
459
460### 3.0.5
461
462Introduced `componentWillReact`
463
464### 3.0.4
465
466The debug name stateless function components of babel transpiled jsx are now properly picked up if the wrapper is applied after defining the component:
467
468```javascript
469const MyComponent = () => <span>hi</span>
470
471export default observer(MyComponent)
472```
473
474### 3.0.3
475
476Removed peer dependencies, React 15 (and 0.13) are supported as well. By @bkniffler
477
478### 3.0.2
479
480Removed the warning introduced in 3.0.1. It triggered always when using shallow rendering (when using shallow rendering `componentDidMount` won't fire. See https://github.com/facebook/react/issues/4919).
481
482### 3.0.1
483
484Added warning when changing state in `getInitialState` / `constructor`.
485
486### 3.0.0
487
488Upgraded to MobX 2.0.0
489
490### 2.1.5
491
492Improved typescript typings overloads of `observer`
493
494### 2.1.4
495
496Added empty 'dependencies' section to package.json, fixes #26
497
498### 2.1.3
499
500Added support for context to stateless components. (by Kosta-Github).
501
502### 2.1.1
503
504Fixed #12: fixed React warning when a component was unmounted after scheduling a re-render but before executing it.
505
506### 2.1.0
507
508Upped dependency of mobx to 1.1.1.
509
510### 2.0.1
511
512It is now possible to define `propTypes` and `getDefaultProps` on a stateless component:
513
514```javascript
515const myComponent = props => {
516 // render
517}
518
519myComponent.propTypes = {
520 name: React.PropTypes.string
521}
522
523myComponent.defaultProps = {
524 name: "World"
525}
526
527export default observer(myComponent)
528```
529
530All credits to Jiri Spac for this contribution!
531
532### 2.0.0
533
534Use React 0.14 instead of React 0.13. For React 0.13, use version `mobx-react@1.0.2` or higher.
535
536### 1.0.2
537
538Minor fixes and improvements
539
540### 1.0.1
541
542Fixed issue with typescript typings. An example project with MobX, React, Typescript, TSX can be found here: https://github.com/mobxjs/mobx-react-typescript
543
544### 1.0.0
545
546`reactiveComponent` has been renamed to `observer`
547
548### 0.2.3
549
550Added separte import for react-native: use `var reactiveComponent = require('mobx-react/native').reactiveComponent` for native support; webpack clients will refuse to build otherwise.
551
552### 0.2.2
553
554Added react-native as dependency, so that the package works with either `react` or `react-native`.
555
556### 0.2.0
557
558Upgraded to MobX 0.7.0
559
560### 0.1.7
561
562Fixed issue where Babel generated component classes where not properly picked up.
563
564### 0.1.6
565
566`observer` now accepts a pure render function as argument, besides constructor function. For example:
567
568```javascript
569var TodoItem = observer(function TodoItem(props) {
570 var todo = props.todo
571 return <li>{todo.task}</li>
572})
573```
574
575### 0.1.5
576
577observer is now defined in terms of side effects.
578
579### 0.1.4
580
581Added support for React 0.14(RC) by dropping peer dependency