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

"mobx-react" package is deprecated?

mobx-react Now not recommended to use? https://github.com/mobxjs/mobx-react
it-efrem
  • 107
  • 1
  • 6
0
votes
1 answer

How to define an action in a mobx store using mobx-react?

Have been following a few tutorials on youtube and have pretty much never seen anyone explicitly define an action that mutates the state they just throw in into the store. I have been doing the same and while it works a 100% it throws a warning on…
meowzart
  • 75
  • 1
  • 8
0
votes
2 answers

Redirect not working with react router authenticated route

I'm attempting to create a private route based on the answers here, however it is not performing the redirect. This is my private route component import React, { Component, useContext } from "react"; import { Redirect, Route, RouteComponentProps,…
Konzy262
  • 2,747
  • 6
  • 42
  • 71
0
votes
1 answer

How to make RootStore with Mobx6

so mobx 6 is out and i am trying to implement a basic store like that : export class AuthStore { rootStore value constructor(rootStore) { makeObservable(this, { value:observable }) this.rootStore = rootStore } } and class…
Eran Abir
  • 1,077
  • 5
  • 19
  • 34
0
votes
1 answer

Loading API data before Table render ReactJS

I use MobX to control my ReactJS state/components and I also use an async call through MobX in order to retrieve the data, this is typically called in my header throuhg componentDidMount(). (I already know my code isn't the cleanest and most likely…
0
votes
1 answer

mobx reaction is failing to trigger when adding to an observable array

I'm attempting to trigger a mobx reaction when an item is added to or removed from an observable array. Currently it's only triggered when removing an item type QueryParam = { name: string value: string } export default class SelectStore { …
Konzy262
  • 2,747
  • 6
  • 42
  • 71
0
votes
2 answers

Implement Mobx ViewModel in React Component state

I want to use Mobx ViewModel (from mobx-utils) in a functional component in React. Well, My model in this case is a state. (e.g - company in the next line): const [company, setCompany] = useState(store.companyObservable) And according to that, the…
levi
  • 1,077
  • 2
  • 11
  • 24
0
votes
1 answer

Mobx React - CreateViewModel - Error - Object is not a function

I am trying to use the createViewModel from mobx-utils in a Mobx/React app. My Store is: export class CompanyStore extends StoreExt { @observable companyDetails: ICompanyDetails = {} } And when i use the 'createViewModel' function, in the…
levi
  • 1,077
  • 2
  • 11
  • 24
0
votes
1 answer

react input component gets store overwritten onChange

Ok, I'm new to react and mobx, and I'm experiencing some issues to manipulate the store. When I'm typing at the input, the value gets overwritten for each char typed. The component: @withStore @observer class ConfigModel extends Component { …
hgodinho
  • 70
  • 2
  • 8
0
votes
1 answer

migration of angular 1.5 to angular10 , ngModel is not working

I'm working on migration of angular1.5 to angular10. My current code in angular1.5 with mobx(mobx-angularjs package is being used). I have used downgradeComponent approach. export default angular .module('test', []) .directive('myTest',…
Thavaprakash Swaminathan
  • 6,226
  • 2
  • 30
  • 31
0
votes
1 answer

MobX stores updating 'delayed'

I have a simple tab menu, and an overview: Within the overview, I'm reaching for a store, a MobX store, and I'm fetching what tab I'm currently in, then displaying in as a text to see what tab I've selected, problem is that the text update is…
B2B
  • 11
  • 1
0
votes
1 answer

What does this MobX syntax do? Where is it documented?

The latest MobX 6.0.1 release has a syntax that appears in the example app at https://codesandbox.io/s/minimal-observer-p9ti4 that I don't understand. The code is: const TimerView = observer(({ timer }: { timer: Timer }) => ( Seconds passed:…
PatS
  • 8,833
  • 12
  • 57
  • 100
0
votes
1 answer

How to get component own props from decorator function

My component needs to use properties that I'm passing when I creating the component (OwnProps), plus it needs to use props from MobX Store. I know how to connect component that is using only Mobx Store or only OwnProps. But I can't find a way to…
PilgrimViis
  • 1,511
  • 2
  • 17
  • 21
0
votes
1 answer

Mobx and React async function call is freezing UI while onClick call is not

So we have been trying to solve this for hours and cant figure out whats the issue. I am afraid I cant include any code due to the companies policy, but I can include a sample code with an explanation. Basically we have a function where we select…
AlwaysConfused
  • 729
  • 2
  • 12
  • 37
0
votes
1 answer

React Native - Mobx how to initialize store with remote data

How can i initialize mobx store and load data from my api server. I have to request an api server to get products data and put that data into the observable array. Then i will make computed functions to query over that array (ex. to get products by…