mobx-react-form is not compatible with MobX 6.1
See original GitHub issuemobx-react-form is not compatible with MobX 6.1. The @action
decorator does not apply to some methods.
Example:
import { autorun } from "mobx";
import MobxReactForm from "mobx-react-form";
const form = new MobxReactForm({
fields: {
note: {
value: "Foo"
}
}
});
autorun(() => {
console.log(form.$("note").value);
});
form.$("note").set("Bar");
Console output:
Foo
[MobX] Since strict-mode is enabled, changing (observed) observable values without using an action is not allowed. Tried to modify: Field@5.$value
Bar
CodeSandbox: https://codesandbox.io/s/angry-ganguly-t4f4i.
The problem is the use of mixins https://github.com/foxhound87/mobx-react-form/blob/master/src/index.js#L5-L30. I created a playground in which you can experiment with this without diving into the implementation details of the mobx-react-form https://codesandbox.io/s/mobx-react-form-mixins-playground-sbt0c.
Issue Analytics
- State:
- Created 3 years ago
- Reactions:1
- Comments:7 (4 by maintainers)
Top Results From Across the Web
reactjs - MobX 6 | React Not Found Function - Stack Overflow
I have attached the output to the attached picture. What would be the reason? import {observable, computed, action, makeObservable} from 'mobx'; ...
Read more >Enabling decorators · MobX
Decorator syntax and Create React App (v2). Decorators are only supported out of the box when using TypeScript in create-react-app@^2.1.1 and newer. In ......
Read more >Handling React Forms with Mobx Observables
Learn a single approach to handle React forms with Mobx observables without using an already existing form library.
Read more >mobx-react | Yarn - Package Manager
React bindings for MobX. ... Package with React component wrapper for combining React with MobX. ... Make mobx-react compatible with TS 4.8+ ...
Read more >mobx-react/CHANGELOG.md - UNPKG
The CDN for mobx-react. ... 3, ### 6.1.2 ... 45, - Changing the set of stores in `Provider` is no longer supported and...
Read more >
Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free
Top Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
@rafaeldsousa I’m waiting for feedback from @foxhound87 😃
@smiley-uriux - please see my latest PR. I’m with you, this mobx ecosystem is really important. I’ve also been updating mobx-router.