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

1624 questions
0
votes
2 answers

Mobx textField's attribute value doesn't change

I have TextFields from material-ui. On value change I assign the value to model.data. Model is mobx FormStore. In console as you can see the value changes, but input fields don't have any characters when I type. Why does the TextField's attribute…
0
votes
1 answer

React Mobx Wizard not re-rendering

I am having an issue with mobX not firing a render. Think of a wizard with next/previous buttons to load steps (other components). First the code (in TypeScript) - *(Note - I changed names and simplified this code to just show the issue, the actual…
Jeff
  • 187
  • 2
  • 10
0
votes
2 answers

Can't get the most basic mobx store to work with observer

I just started out trying mobx-react using stores, and want to use a store plus a single observable, but can't even get this to work. With @observer, I get the error Uncaught TypeError: Cannot assign to read only property 'render' of object…
simonzack
  • 16,188
  • 11
  • 62
  • 100
0
votes
2 answers

React + mobx object keeps getting updated

The problem I am having is that I have an object which is used throughout entire class which is stored under the observable value and I have another object which is stored as a back up of the first object and the value is non observable and its…
AlwaysConfused
  • 650
  • 1
  • 9
  • 28
0
votes
1 answer

Dynamic Mobx Stores in React Native

This is kinda a vague question I have a React Native component that is going to be used in a ListView, each one is going to be slightly different in the sense that each component is populated different information in its props, each component also…
J DOe
  • 453
  • 7
  • 12
0
votes
1 answer

Invariant failed: Changing observed observable values outside actions is not allowed

How can I write this with mobx and axios? I am trying to use the arrow function to keep the scope of "this" but I might be doing it wrong. @action saveMode() { axios.post('/Course/Post', { Name: "test41515"}) .then(response => { …
chobo2
  • 75,304
  • 170
  • 472
  • 780
0
votes
1 answer

IntelliJ shows this.props is undefined while console.log suggests otherwise

I have a dialog based on material-ui written with React and mobx, I'm pretty new to mobx+react and trying to understand the lifecycle here. The component looks something like this: @observer export default class AddDialog extends React.Component { …
Avi
  • 19,035
  • 19
  • 69
  • 108
0
votes
1 answer

How do you store a non mobx-state-tree type (Class instance) in models?

I get: Error: [mobx-state-tree] expected a mobx-state-tree type as first argument, got class HubConnection { constructor(urlOrConnection, options = {}) { options = options || {}; When trying to do this: import { HubConnection }…
Soren
  • 227
  • 1
  • 2
  • 10
0
votes
1 answer

Cannot alter input field in Reactjs?

I have a a table in Reactjs that looks as follows: class ViewLegos extends Component { componentDidMount() { this.props.store.getAllLegoParts(); } render() { const columns = [ { Header: "Piece", accessor:…
Nespony
  • 857
  • 3
  • 14
  • 27
0
votes
2 answers

Updating state in Reactjs?

I am trying to update my state in ReactJS. To do this I have an input field in a Reactjs class. The field is automatically filled in with data from a parent class. The field looks like this:
Nespony
  • 857
  • 3
  • 14
  • 27
0
votes
1 answer

How can a mobx store react to observables of another mobx store?

I'm starting out with mobx and react-native, and trying to split a big giant store into a bunch of smaller ones. What's the right way to imperatively run something in one store, based on @observables / @computed of one or more other stores? I tried…
jd20
  • 383
  • 3
  • 10
0
votes
1 answer

Console.log prints twice and map doesn't work in reactjs/mobx project

I have the below fetch request in my Mobx store: getAllLegoParts = action("get all lego", () => { this.legoParts = fromPromise( fetch("http://localhost:8000/LegoPieces", { method: "GET", cache: "no-store" }).then(response =>…
Nespony
  • 857
  • 3
  • 14
  • 27
0
votes
1 answer

Create a template for classes

I have 10+ classes (MobX stores, but not relevant) which have 90% of code in common: PriceStore.js // Store to get the latest price of something class PriceStore { @observable price; @observable error; constructor() { …
jeanpaul62
  • 6,379
  • 6
  • 40
  • 74
0
votes
0 answers

mobx observable field not updating

I am new to mobx so forgive me for a likely basic question. Here's what I have: @observable myInfo; ... @observer class Klass { @computed get myInfo() { if (cond1 && cond2) { return `${data1} ${data2}`; } …
Mark
  • 3,488
  • 4
  • 21
  • 42
0
votes
2 answers

React-native MobX @observable is always undefined

globalStore.js import {observable} from 'mobx'; export default class globalStore { @observable loggedIn = false; } Followed by main App.js: import LoginForm from './src/components/LoginForm'; import { observer } from 'mobx-react'; import…
cbll
  • 4,389
  • 13
  • 54
  • 95
1 2 3
99
100