Questions tagged [mobx-react]

MobX is a battle-tested library that makes state management simple and scalable

React and MobX together are a powerful combination. React renders the application state by providing mechanisms to translate it into a tree of renderable components. MobX provides the mechanism to store and update the application state that React then uses.

Both React and MobX provide optimal and unique solutions to common problems in application development. React provides mechanisms to optimally render UI by using a virtual DOM that reduces the number of costly DOM mutations. MobX provides mechanisms to optimally synchronize application state with your React components by using a reactive virtual dependency state graph that is only updated when strictly needed and is never stale.

850 questions
5
votes
2 answers

Can't find variable: Symbol from (on Physical React Native Android device only)

Running the newest version of RN, I get the below error. It only occurs however on a physical Android device (tried two different ones) - Android simulators and iOS are fine. Any ideas on whether this is some kind of caching issue (which I doubt…
hardanger
  • 2,349
  • 1
  • 16
  • 23
5
votes
2 answers

Component doesn't re-render when store updates - Mobx

I have three components; Form, Preview & AppStore. Clicking a button in Form adds an item to the store. This seems to work fine except that the list in the Preview component isn't updating/re-rendering when the store changes even though it has an…
George Bleasdale
  • 343
  • 7
  • 16
5
votes
0 answers

Module build error in React: "Unknown plugin "@babel/plugin-proposal-decorators" when compiling React App

I am putting together a small React App and trying to incorporate MobX into the dependencies. Below is the package.json setup for babel. "babel": { "presets": [ "@babel/preset-env", "react-app" ], "plugins": [ [ …
AltBrian
  • 2,392
  • 9
  • 29
  • 58
5
votes
3 answers

Mobx Flow functions are not type checked by FlowType without .bind(this)

When we use MobX flow decorated functions, flowtype thinks this is of type any and does no type checking. class MyComponent extends Component<*> { actionMethod = flow(function*(){ yield this.notAMethod(); }); } However, if we bind…
Adam Mills
  • 7,719
  • 3
  • 31
  • 47
5
votes
2 answers

How to make MobX update the component when observable is not used in the render method?

After switching from Redux to MobX for React I'm starting to extremely like MobX. It's pretty awesome. MobX has a certain behavior where it won't update component if the provided store observable is not used in render. I think generally that's a…
Dominik Serafin
  • 3,616
  • 3
  • 17
  • 27
5
votes
1 answer

PureComponent decorated by mobx-react throws error about `shouldComponentUpdate` presence

In console I see this warning: index.js:2178 Warning: Body has a method called shouldComponentUpdate(). shouldComponentUpdate should not be used when extending React.PureComponent. Please extend React.Component if shouldComponentUpdate is…
zmii
  • 4,123
  • 3
  • 40
  • 64
5
votes
1 answer

undefined is not a function (evaluating 'decorator(target, property, desc)')

I want to integrate mobx and mobx-persist with react-navigation. I read these articles: [1] https://hackernoon.com/react-navigation-with-mobx-2064fcdaa25b [2]…
b24
  • 2,425
  • 6
  • 30
  • 51
5
votes
1 answer

React-Router & MobX - Provider

I am trying to access my store from every component page I have, so I followed the following tutorial in order to connect React Router & MobX. http://frontendinsights.com/connect-mobx-react-router/ However, I am facing a problem at The MobX way –…
Emixam23
  • 3,854
  • 8
  • 50
  • 107
5
votes
2 answers

React Mobx componentDidUpdate is not updating when observable changes

I'm new to Mobx and reactjs in general, I have knowledge in Redux and react native, and in Redux when I used to call an action and the props get updated, the componentDidUpdate life cycle method is triggered. The scenario I'm having now is login. so…
Ibraheem Al-Saady
  • 854
  • 3
  • 14
  • 30
5
votes
2 answers

MobX not updating React view when pushing to an array

My Store.js: import { observable, useStrict, action } from 'mobx'; useStrict(true); export const state = observable({ contacts: [] }); export const actions = { addContact: action((firstName, lastName) => { …
user818700
5
votes
1 answer

How to pass props from mobx-observable to mobx-react observable?

I cant figure out mobx-react... How do I pass props from a mobx observable to a mobx-react observer? The code below doesn't works, but I feel like it should. Can someone tell me what is going wrong? let mobxData = observable({information: "this is…
joeydebreuk
  • 376
  • 2
  • 8
5
votes
2 answers

MobX, and connection between stores

guys. I`m working on ract+mobx+firebase app. I want to separate my app logic to 3 stores: authStore - store, where all firebase auth actions is happens userStore - where, stored all current user data, that came from firebase database edtorStore -…
Eugene Alitz
  • 222
  • 3
  • 12
5
votes
1 answer

Access MobX state outside of React Components?

I'm using a MobX store to hold some user authentication data as an observable. I'd like to access some data for some functions I'd like to run outside of the inject/observer pattern with components. Is that wise to do? For example an authenication…
eddiewang
  • 415
  • 5
  • 21
5
votes
1 answer

Stuck on "unique key" warning

I'm currently adapting a Mobx tutorial for a to-do app. link What I want to do is add a simple counter button to each rendered list item. I figured this would be pretty simple, but I must be making a syntactical error because I cannot get things to…
Darthmaul
  • 151
  • 1
  • 10
5
votes
1 answer

Canceling mobx autorun function on componentWillUnmount

I have the following autorun function in my componentDidMount: componentDidMount() { this.autoUpdate = autorun(() => { this.setState({ rows: generateRows(this.props.data) }) }) } The…
Miha Šušteršič
  • 9,742
  • 25
  • 92
  • 163