Questions tagged [mobx]

Functional reactive programming library in JavaScript.

About

MobX is a battle tested library that makes state management simple and scalable by transparently applying functional reactive programming. The philosophy behind MobX is very simple:

Anything that can be derived from the application state, should be derived. Automatically.

which includes the UI, data serialization, server communication, etc.

Links

1876 questions
0
votes
1 answer

How to track mobx global store changes in componentDidUpdate

I am playing around with react + mobx + mobx-react library. I have created mobx store to store the app settings(appSettingsStore). My react app has 2 components namelyAppHeader & AppBody. The AppHeader has dropdown and onChange value is store in…
TEMP
  • 235
  • 2
  • 7
  • 17
0
votes
1 answer

React-Mobx 2020. inject hooks and useObserver

When I get the data (view) from useStore, I have to write all the way to this (view: myStore.menu.view) and still wrap it all in useObserver. Is there a way to shorten the code, but still keep the logic the same? I use Mobx and React Hooks. Thanks…
EmilM
  • 107
  • 1
  • 3
  • 11
0
votes
0 answers

In TypeScript, defining a function that maps a set of functions

I'm trying to define a function that will take a set of functions and wrap them in MobX's flow. My actual code does a bit more than just wrap with flow, but that isn't important to this question. I've devised some TypeScript types that will…
Michael Best
  • 16,623
  • 1
  • 37
  • 70
0
votes
4 answers

react + mobx example Attempted import error: 'useObservable' is not exported from 'mobx-react-lite'

please suggest the solution. the error which is shown on browser is Failed to compile ./src/App.js Attempted import error: 'useObservable' is not exported from 'mobx-react-lite'. import React from 'react'; import './App.css'; import {observer,…
Pawan Deore
  • 162
  • 3
  • 10
0
votes
1 answer

Can I use one mobx store in two different components in react-native app?

I have a module with topTabNavigator that wrapped with mobx provider with the store: export class ModuleTeam extends Component { render() { return ( ); } } And…
jocoders
  • 1,594
  • 2
  • 19
  • 54
0
votes
1 answer

How to determine when mobx computed variable is called?

I have been playing with mobx computed, but I am having trouble understanding what is happening with the following code: import React, { Component } from "react"; import { render } from "react-dom"; import { observable, computed } from…
Pavan Gangireddy
  • 417
  • 1
  • 3
  • 13
0
votes
1 answer

Flutter 1.17 update not finding mobx dependencies

Error in finding mobx dependencies After updating both flutter and dart i m using both latest SDK when i added mobx dependencies in my pub spec.yml i got this error "A package may not list itself as a dependency."
Ajit Singh
  • 43
  • 1
  • 1
  • 4
0
votes
1 answer

Can I access the parent/sibling of a key in an observable?

Given an observable like: import "./styles.css"; import { observable } from "mobx"; const a = observable({ firstName: { value: "a" }, lastName: { value: "b", foo() { // can I access firstName from `this`? return…
Stephen Haberman
  • 1,454
  • 1
  • 9
  • 12
0
votes
1 answer

Mobx method's object is not a function

I'm trying to access a method's objet (here greet() method) throught a mobx array, but I'm stuck with : TypeError: person.greet is not a function Person class I have a Person class, with greet method : export class Person { public id: number…
Xero
  • 3,951
  • 4
  • 41
  • 73
0
votes
6 answers

React Uncaught SyntaxError: Unexpected token '<' and Manifest: Line: 1, column: 1, Syntax error

I am creating React web app from two folders and the dynamic routes within the app return these errors. Static routes work just fine. I get the errors: Uncaught SyntaxError: Unexpected token '<' manifest.json:1 Manifest: Line: 1, column: 1, Syntax…
moey
  • 23
  • 1
  • 5
0
votes
0 answers

Mobx does not updating store. need to refresh manually after every action call

import {action, observable, autorun} from 'mobx'; class Streams { @observable data = null; @action getStreams() { this.data = ['pen', 'book', 'pencil']; } } index.js //stores import Streams from './streams'; export default { …
kalyani_jamunkar
  • 582
  • 1
  • 13
  • 33
0
votes
1 answer

ObservableList overwriting values from other objects when adding a new object
I am developing a restaurant delivery app and I am having problems when adding the same product on the list but with different values, it overwrite the value from the old ones. I have a Store called BaseStore that has a "Bag" object as an…
djalmafreestyler
  • 1,703
  • 5
  • 21
  • 42
0
votes
1 answer

How to use Mobx for List object in Flutter?

I want to change the status of checkbox via use Mobx, after the click the value have changed but not update on UI, Observer don't see change action that it is rebuilding this Widget In file Mobx: @observable List statusCheckbox =…
0
votes
1 answer

REACT: How to build object field selector hook similar to redux useSelector

I'm trying to build a hook which would return a selected subset of key-value pairs from an object. Assuming that the hook has access to an object which looks like this: const stores = { someStore: { someField: 'fieldValue' } } how can we pass a…
Jakša Mališić
  • 345
  • 7
  • 13
0
votes
1 answer

How to solve `reaction is not defined` when using Mobx?

I am new to React and Mobx and am following an online tutorial. The tutorial says to use reaction eg: reaction(() => list.totalPrice, () => changed++) But I just get the error ReferenceError: reaction is not defined. I'm not sure what this means or…
MeltingDog
  • 14,310
  • 43
  • 165
  • 295