Hello, I'm wondering what people's approach to React state management is, in particular for full stack web developers who work both on the Django and React side of things.
Here are my initial thoughts, based on research more than experience. I'm keen to hear other people's thoughts, and (even better) experiences. There are a number of alternatives out there, but I'll consider three: - React component state. On the plus side this comes out of the box. But coming from an MVC[*] background, tying my state to UI components does not feel right; - Redux. I like the principles; immutability, asynchronous updates, the state being of function of itself, reducers, etc. I'm ok with the verbose implementation. What really bothers me is having to keep all my state in one large unstructured object. Being used to Django's ORM this feels like prehistory. Even using raw SQL is more structured than a plain js object. Things like this: https://redux.js.org/recipes/structuring-reducers/normalizing-state-shape make me feel like I'm basically re-implementing the database engine. - MobX. Being used to writing models, MobX feels a lot more natural that either of the other options. Models as classes, synchronous updates, etc. There are people out there however who claim that MobX re-introduces classes of bugs that Redux-like flows were designed to eliminate (though I've not seen anyone provide actual examples of why this is the case). The above sounds like I would lean towards MobX; but then I'm wary of making a choice because it feels more natural from a Django perspective. Django is not a reactive framework, Django is a stateless build pipeline. What is natural in Django might not fit well in a stateful reactive context. So - for those of you who combined Django and React, what state management approach did you use (or are thinking of using) and why? Thanks :) Alice [*] I know, MTV. Also I know that MVC is considered a bad word in js frontend world. -- You received this message because you are subscribed to the Google Groups "Django users" group. To unsubscribe from this group and stop receiving emails from it, send an email to django-users+unsubscr...@googlegroups.com. To post to this group, send email to django-users@googlegroups.com. Visit this group at https://groups.google.com/group/django-users. To view this discussion on the web visit https://groups.google.com/d/msgid/django-users/07dc5e71-0c22-c496-3180-090f24912d7a%40gmail.com. For more options, visit https://groups.google.com/d/optout.