The core idea of Flux, and the theory behind Redux, is very simple. But I personally dislike Redux.
The core idea of Flux, and the theory behind Redux, is very simple. But I personally dislike Redux.
@observer seems like the same thing as connect(), but it passes down the entire state as context.
¯\_(ツ)_/¯
Just curious, how can you test a mobx store independently? (Sans components)
The way I have it setup, everything is in a central store, and the components only access it rather than have observables for any kind of local state.
Local state is handled with boring old setState calls, so the store and data-layer is totally independent of React, and can be tested without even importing the library.
> (Look for the constant MAX_REACTION_ITERATIONS)
Okay... that's interesting. It dates back to Feb. 2016th[1], and I'm not caught up with that version. My pull comes from January [2].
Giving it a brief look over, it looks like they changed the codebase to allow for reacts to trigger themselves. My version doesn't allow that. It's a fatal error instantaneously.
Presumably, this was done to let people write recursive functions.... but I'm not 100% sure this is a good idea.
Edit: I think my version implicitly has MAX_REACTION_ITERATIONS = 1, so observables triggering itself is an immediate error.
[1] https://github.com/mobxjs/mobx/commit/a38b6a8c255d772a79dadd...
[2] I know I should update, but I come from the boring Python world where you don't expect the internals of a library to change too drastically year to year.
Having DRY code is not "magic".