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

React component not updating when the MobX object updates

I just started using MobX so pardon me if I am missing something very trivial here. To get my feet wet I just built a simple add subtract project that makes use of contexts. There are 3 components I made AddButton, SubtractButton and Answer. All…
Tushar Chutani
  • 1,522
  • 5
  • 27
  • 57
0
votes
1 answer

MobX useObserver not working on destructed params

For example I have Store and App when I try to destruct Store's params useObserver not working React not re-render app when Store's title changes. But if I will not destruct params and will use directly in return like Store.title it will work. Why…
Aliaga Aliyev
  • 415
  • 1
  • 6
  • 22
0
votes
2 answers

React/Mobx: TypeError: Cannot read property 'map' of undefined

What I'm trying to do; Pull data from API and insert it into a mobx store called UserStore Retrieve and display User Store Data in another component This is my UserStore.ts import { observable, action } from 'mobx'; import { getUser } from…
MD9
  • 105
  • 2
  • 14
0
votes
1 answer

StateManagment tools vs native useState

im just curious here but is there any performance hit when using redux or mobx compared with native useState or context api? no matter how small example // mobx code @observable isLoading: boolean = false; @action setLoading = () => { loading =…
user13468285
0
votes
1 answer

(React & Mobx & Leaflet) await and then are not working as I expected

Good evening. The purpose of this component is to create a map taking data from observable curentLocation. loadInitialLocation() and newMap() in useEffect() should only be called once, and updateMap() in autorun() is called whenever the obrservable…
nkforce
  • 29
  • 2
  • 9
0
votes
1 answer

Mobx Store shows lag in nested input range. Causes slow performance

I have a simple MobX store with padding & padding2, the difference is one is an object: import { observable, action, makeObservable } from "mobx" export type Padding2 = { horizontal: number vertical: number } export interface IStore { …
deadcoder0904
  • 7,232
  • 12
  • 66
  • 163
0
votes
1 answer

How can I clone a object that has a observable property and autorun the new object's method?

There is a object has a observable property . Autorun works well. I want to clone a new object , but autorun won't work. Here is my code: Step1: vim roadStore.mjs import mobx from 'mobx' const { observable, autorun } = mobx import ramda from…
0
votes
1 answer

React(mobx) observer components render() not called when observable changes

In the following sample code, unfinishedTodoCount (under LoadContent component) is not updated when todo items checked. I dereference unfinishedTodoCount in the render method of TodoListView so i think it must be tracked by mobx. (I use "trigger…
subcoder
  • 636
  • 8
  • 15
0
votes
1 answer

Updating Todo list via mobx with react and typescript

Hi guys i was just trying out mobx today and made a Todo List with it, the problem is the list isn't updating here after the item is removed from the list even though i had made observer and observable. You can also directly check my code here at…
Ratnabh kumar rai
  • 1,426
  • 4
  • 21
  • 48
0
votes
0 answers

Mobx Upgrade With Base Classes (v4/5 to 6)

I have the classes.... export class CustomField extends GenericField { @observable customProperty } class GenericField { @observable genericProperty } I ran the codemod to upgrade Mobx as per.....…
Exitos
  • 29,230
  • 38
  • 123
  • 178
0
votes
0 answers

How to add a value conditional in a array of object

I have an array of object which looks like @observable setting = [ { collapseHeader: SettingsSectionDisplayName.Settings, section: SettingsSection.Settings, isSelected: isLogged() ? true : false, ==> This does not work. } …
ganesh kaspate
  • 1
  • 9
  • 41
  • 88
0
votes
0 answers

React useEffect loads new but won't clear the old

https://codesandbox.io/s/stacked-bar-useeffect-upbf8 In the above code, the props key changes, and the graph updates but the previous iteration still shows up and makes a mess. Where am I going wrong? I've tried to do a cleanup, and used the minimal…
rvz
  • 43
  • 6
0
votes
1 answer

Error when loading mobx-react as UMD from a CDN

Since version 6.0.0, loading mobx-react as UMD from a CDN causes an error. Is there a solution to this? Example const { observer } = mobxReact; const App = observer(() =>
Example
); ReactDOM.render(,…
Tholle
  • 108,070
  • 19
  • 198
  • 189
0
votes
1 answer

set mobx store in const value in react native

how can i set const value using mobx obeserve data? as i don't know how can i define props here. export const BASE_URL = base_url_from_mobx i have some data in this function. From there i will have some confidential data and a base url. This…
Wasi Sadman
  • 1,382
  • 1
  • 15
  • 27
0
votes
1 answer

Reactjs : error boundary with mobx async call

Hello I'm trying to implement error boundary to my system, but I'm having problems I have an asynchronous call to my api, to check if the backend is up and if the browser session is auth, for testing I left my backend on, but my fallback was not…
Ming
  • 1,349
  • 4
  • 13
  • 36