Skip to content

My MobX code is slower than the Redux version, what am I doing wrong? #3309

Discussion options

You must be logged in to vote

Updated example below.

One of the key things for Mobx performance is to make your observers observe as little as possible.

  • In your original example, every keypress caused Data to update, and all MDTextAreas observed that. This forced a render of all textareas even though only one needed to update.
  • In the modified code, a keypress in one textarea only updates one Data and only causes one MDTextArea / textarea to update.

It takes little bit of planning at first to structure the code in the right way, but it quickly becomes second nature. You might be worried it's going to force your state classes into a weird shape, but it's quite the opposite in my experience - it tends to push towards a…

Replies: 2 comments 2 replies

Comment options

You must be logged in to vote
0 replies
Comment options

You must be logged in to vote
2 replies
@jacqueslenormand
Comment options

@georgemarrows
Comment options

Answer selected by kubk
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
2 participants