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
0 answers

Minimum code for listening to changes in firestore collection w/ BLOC (flutter)

I am new to the BlOC style of programming (I usually use mobx, but I want to listen to a collection in firestore and it seems like BLOC is the best way to do this). After reading half a dozen tutorials, I am thoroughly confused. There seem to be API…
gollyzoom
  • 519
  • 1
  • 6
  • 21
0
votes
1 answer

subscribing mobx @observable using rxjs Observable but not getting on change in a deep level component (ts file)

i am trying to get change from angular-mobx store using rxjs observable. but not getting any change from there, if observed array changed. But if i assign new value using '=' sign then i got change in subscribe. Anyone can explain it ? or help to…
Usman Ahmad
  • 31
  • 1
  • 9
0
votes
1 answer

How can I access intl.formatMessage() in mobx store in reactJS app?

I have two JSON files with names 'en.json' and 'fr.json' which has all the translations. en.json { "General.LearnMore": "Learn More" } I have a mobx store (.ts file) and I want to access intl.formatMessage() in that class. It is easier in functional…
newbie
  • 530
  • 1
  • 9
  • 36
0
votes
1 answer

MobX. @observable works but @computed don't

I have the following code: It works fine if _isFavorite variable is public observable. But once I change it to @computed, it triggers only once. But further @action callings don't trigger @computed. This works fine, once isFarovite is changed: class…
Svyat
  • 82
  • 2
  • 9
0
votes
1 answer

Creating Firestore Listeners in a mobx store (flutter)

I am currently working on a flutter app using firestore and mobx. I use mobx to keep the UI up to date, and make api calls to firestore (so the data flow is firestore -> mobx store -> UI). I want to set up listeners to listen for real-time changes…
gollyzoom
  • 519
  • 1
  • 6
  • 21
0
votes
1 answer

Restricting mobx store to save only 1 item in an array

I am trying to create a timed buffer that only stores 1 item in a mobx observable. I call a function in store that creates a timer so that no other item can be saved in the store until the timer is complete. However the observable seems to be…
jjwallace
  • 168
  • 2
  • 16
0
votes
1 answer

Can log updated value but cant render it with mobx flow

I am trying to make a really simple api call without any logic at all.Althoough I get an illegible object in the consoel called 'proxy' at leaset (not expected either) I cant return anything in the render() method and it throws a typeError. my…
0
votes
1 answer

What does this symbol represent in the mobx documentation? an array as another array exported type

In this link: https://mobx-react.js.org/recipes-context line 10 of the create store there is: friends: [] as TFriend[], What does this mean? Is this Javascript or is this specifically for MobX? In the beginning theres: export type TFriend = { …
hellomello
  • 8,219
  • 39
  • 151
  • 297
0
votes
1 answer

Using mobx actions to fetch data/execute async requests

Please advise if it is correct to use mobx actions (https://mobx.js.org/refguide/action.html) to fetch remote api or do similar stuff: @action readSomething() { this.observableLoading = true; executeRead( this.param1, …
ror
  • 3,295
  • 1
  • 19
  • 27
0
votes
1 answer

KonvaJs example does not work once i updated mobx 5

I am trying to develop on that KonvaJs example: https://konvajs.org/docs/sandbox/Window_Frame_Designer.html When cloned the repository everything is working fine. However, Once i updated mobx from 4.3.1 to 5.15.0 it gives that error; Error: MobX…
mkaya387
  • 368
  • 2
  • 10
0
votes
1 answer

Can't redirect using props.history.push with react-router

I'm actually working on my very first React app and I'm struggling with the redirect after login. The project has been created with create-react-app v.2, I use mobx to handle the state management, and I'm trying to use react-router to navigate…
Julien Berthoud
  • 721
  • 8
  • 24
0
votes
1 answer

How to create a base observer class in typescript/react?

I have a common pattern my react app where I have many components that observe the same model. The code for each component looks like this: export interface IAppModel { someLocation: { x: number, y: number } ; doSomething: () =>…
Eric Jorgensen
  • 1,682
  • 2
  • 14
  • 23
0
votes
1 answer

Persist data with mobx-persist and AsyncStore

I'm trying to use AsyncStorage ('@react-native-community/async-storage') persistance using mobx-persist. My implementation is basically this: https://github.com/pinqy520/mobx-persist. I can see my store hydrated (in constructor of store itself). I…
ror
  • 3,295
  • 1
  • 19
  • 27
0
votes
2 answers

mobx observable array has changed, but render function does not re-run

@observer export class BookshelfComponent extends React.Component<{}, {}> { @observable libraryData: ILibraryBook[] = [{isSelected: false}, {isSelected: false}]; bookItemPress(index: number) { this.libraryData[index].isSelected =…
perry
  • 1
  • 1
0
votes
1 answer

Variable declared in class body is undefined within a function in TypeScript and MobX

I'm writing a simple count store with MobX and TypeScript because I had some issues with JavaScript. This is the full code: import { observable, autorun, computed, action } from "mobx"; class CountStore { @observable count: number = 0; …
user4383363
1 2 3
99
100