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

ReactJs Lazy loading with conditional

Hello I'm in trouble with how I can load my components using asynchronous calls Basically when opening the page I check my api if the user has any valid token (it is active), if it is not active the login page will be rendered if not the dashboard…
Ming
  • 1,349
  • 4
  • 13
  • 36
0
votes
0 answers

Mobx observing array of observable objects

I have a table component I've built for my app that leverages mobx and works fine. I want to add in the ability to update objects inside the tables data without reloading the page. The setup currently looks like this (simplified): export const…
Brad Herman
  • 9,665
  • 7
  • 28
  • 30
0
votes
0 answers

Issue with mobx + react can't do computed method due to diffrent wrappers on variable from mobx

I have an api call which nicely get a status code and data value, then I assign this data to mobx variable. Then I tried to do computed field but it gave me an error, I consoled logged what's going on and what it showed me that api call indeed gives…
Eldar Tailov
  • 358
  • 5
  • 18
0
votes
1 answer

Mobx and d3 Stacked Bar in React

https://codesandbox.io/s/charming-ives-3jnnn As per the codesandbox linked, I have a bar chart that counts tracks over a month from 4 different sensors. I followed this tutorial:…
rvz
  • 43
  • 6
0
votes
1 answer

How do observers receive props?

I can understand how TodoListView receives { todoList } in its observer because its props is being referenced by render(, document.getElementById("root")); But I don't understand how TodoView receives { todo } in…
dev_el
  • 2,357
  • 5
  • 24
  • 55
0
votes
1 answer

Mobx object destructuring props clarification

In TodoListView why can't I replace { todoList } with props.todoList and replace the following instances of todoList with props.todoList to achieve the same result? import * as React from "react"; import { render } from "react-dom"; import {…
dev_el
  • 2,357
  • 5
  • 24
  • 55
0
votes
1 answer

ReactJS and Mobx RootStore and children stores getting undefined

I'm trying to create a rootStore with two stores, currentUser, and AuthUser, I created a context, and tried to use it with useContext, but for some reason without success RootStore and rootStore Context: export class RootStore { @observable…
Ming
  • 1,349
  • 4
  • 13
  • 36
0
votes
2 answers

Having problem w/ flutter mobx RadioListTile

I'm having problems with mobx and radiobox: screen don't update when selected. I think it's a silly mistake, here are my main.dart, teste_store.dart and pubspec.yaml. The partial file .g was generated with build_runner and mobx_codegen. A message…
Rodrigo Lima
  • 103
  • 5
0
votes
0 answers

Sending props to React component from nested MobX store is not working?

I'm new to MobX and I'm looking into concept of using root store and having children and grandchildren stores. However, what I'm not sure is whether it's possible to have a following store structure (this is my RootStore.js file): class RootStore…
Sill
  • 17
  • 5
0
votes
2 answers

What's the difference between @computed and @action in MobX?

What's the difference between @computed and @action in MobX? They both are functions, so what is difference between them?
sima ghoreyshi
  • 379
  • 5
  • 21
0
votes
0 answers

React - Component Lifecycle when pressing "back" from an external URL

Context: I am creating a simple web app where the user can login, select the amount they wish to pay, and then press a Pay button which redirects them to a payment gateway in order for them to pay. Problem: When they press the Pay button, I set a…
Cecilia Mzayek
  • 65
  • 2
  • 11
0
votes
0 answers

React with MobX: Unhandled Rejection (TypeError): project.record.comments.map is not a function

My store has an item that the initial value is set to an empty array. In the store constructor, I load the data from API. When I try to iterate that array in React Component I sometimes (sometimes it works, sometimes not) get an exception: Unhandled…
Povilas
  • 627
  • 2
  • 6
  • 19
0
votes
1 answer

MobX conditional updating without shouldComponentUpdate

So my case is very similar to Slack chats. I have a domain store with chats and when I open some chat with unread messages I'd like to have some separator between read and unread (new) messages. Also at the moment I open a chat I send a request to…
0
votes
2 answers

Redirect to an invitation link after login/signup in React

I'm building a fantasy sports app. Users can create a league and if successful are given an invitation link to share with other people. All routes except for the login and signup page are inaccessible if a user isn't logged in so when someone uses…
emplexus
  • 63
  • 5
0
votes
2 answers

React "Uncaught Invariant Violation: Element type is invalid" with multiple (up-to-date) 3rd-party react libraries

I'm building a very basic react app as a starting point for new projects and trying to integrate Mobx and Styled Components. The problem I'm running into is that any time I try to include a styled component or react component wrapped with mobx…
John Debs
  • 3,714
  • 2
  • 25
  • 35