TE
TechEcho
Home24h TopNewestBestAskShowJobs
GitHubTwitter
Home

TechEcho

A tech news platform built with Next.js, providing global tech news and discussions.

GitHubTwitter

Home

HomeNewestBestAskShowJobs

Resources

HackerNews APIOriginal HackerNewsNext.js

© 2025 TechEcho. All rights reserved.

Things I wish I knew about state management when I started writing React apps

296 pointsby thereyougoover 5 years ago

41 comments

the_gastropodover 5 years ago
I&#x27;m one of those &quot;old dogs&quot; who don&#x27;t quite get the advantage of using React in the majority of the cases it&#x27;s used. This article didn&#x27;t really help...<p>&gt; What makes these frontends complex? State management. The frontend “knows” a lot of things, and these things interact with each other in non-trivial ways [...] Example: dark mode support. For example, say your app has a dark mode. All your rendered components must know what theme is on, so they can render the UI in the right color.<p>Back in my day.... you&#x27;d slap a class on the &lt;body&gt; tag, and you&#x27;d have all you&#x27;d need for your CSS to style the rest of the page accordingly. How is using Redux an improvement here?<p>None of the examples of &quot;complex&quot; front-ends would be at all difficult in an old-school &quot;just re-render the page&quot; setup using something like pjax or turbolinks. And in my experience (seeing web pages with &gt; 1MB js files) it&#x27;d be faster&#x2F;more responsive for the end-user too.
评论 #22291733 未加载
评论 #22291987 未加载
评论 #22292259 未加载
评论 #22292190 未加载
评论 #22291799 未加载
评论 #22295461 未加载
评论 #22294251 未加载
评论 #22295504 未加载
评论 #22293604 未加载
评论 #22292314 未加载
评论 #22294117 未加载
评论 #22298403 未加载
评论 #22291757 未加载
评论 #22292731 未加载
评论 #22293499 未加载
评论 #22293752 未加载
brlewisover 5 years ago
Point 1 in this article is totally misguided. &quot;State management is how you mitigate prop drilling&quot; implies that when prop drilling is not a problem (i.e. most of the time), that you don&#x27;t need to think about state management. Even if you&#x27;re prop drilling, you need to make sure data is not stored&#x2F;updated in multiple places in your app in order to keep the UI consistent.<p>The one redeeming part of that section of this article is that it links to another article that isn&#x27;t as wrong. The linked article details when prop drilling is and isn&#x27;t a problem. And most of the problems it describes can be reduced by using TypeScript. <a href="https:&#x2F;&#x2F;kentcdodds.com&#x2F;blog&#x2F;prop-drilling" rel="nofollow">https:&#x2F;&#x2F;kentcdodds.com&#x2F;blog&#x2F;prop-drilling</a>
评论 #22293020 未加载
评论 #22293818 未加载
PaulDavisThe1stover 5 years ago
So let me just check that I understand this correctly.<p>A whole bunch of problems that were &quot;solved&quot; (or at least, had fairly good solutions) in the context of desktop GUI toolkits have resurfaced in the context of application development confined to the web browser.<p>Almost none of the previous &quot;solutions&quot; are usable, because of the specifics of the theoretically portable &quot;browser platform&quot; for which all this development is taking place.<p>So instead, an entirely new set of frameworks are slowly being developed to solve the same set of problems that desktop developers worked on 20+ years ago, and are slowly converging on similar approaches?<p>Is that too cynical, or just about right?
评论 #22295039 未加载
评论 #22295048 未加载
评论 #22295029 未加载
评论 #22294996 未加载
评论 #22296093 未加载
评论 #22294992 未加载
qwerty456127over 5 years ago
&gt; Think about the most complex frontends you’ve used. Frontends that made you wonder — “how did they create this”? What makes these frontends complex? State management. The frontend “knows” a lot of things, and these things interact with each other in non-trivial ways. So in my view, state management is the core problem when developing a UI. To build a non-trivial React application, you need to consider state management, in my view. For example, say your app has a dark mode. All your rendered components must know what theme is on, so they can render the UI in the right color.<p>This makes me wonder “how did we allow this to happen”? The beginning of this article alone reflects the whole tragedy of modern programming. When I was a child we would just use common controls and the operating system would paint them whatever way configured in the control panel. Now we have to solve a complex state management problem just to implement a dark mode. Application programming was supposed to become simpler and easier, not this...
评论 #22291386 未加载
评论 #22292841 未加载
评论 #22292520 未加载
评论 #22291781 未加载
评论 #22293896 未加载
评论 #22291346 未加载
vga805over 5 years ago
What&#x27;s the deal with the recommendation to use some library for managing forms? I&#x27;ve been working with React almost since its initial release and I&#x27;ve built some pretty complex forms... yet form libraries remain the one thing I&#x27;ve never really seen a need for.<p>At the very least, using something like formik shouldn&#x27;t be a necessity. There should be some qualifier that it&#x27;s only really needed for very complex forms. Or am I missing something?
评论 #22294259 未加载
评论 #22291193 未加载
评论 #22291223 未加载
评论 #22291171 未加载
评论 #22292379 未加载
评论 #22293860 未加载
评论 #22292477 未加载
评论 #22291177 未加载
评论 #22292237 未加载
pier25over 5 years ago
&gt; You can make API calls in your actions just like you normally would<p>Jesus don&#x27;t do this. Mobx, Vuex, Redux, etc, are about managing application state not about managing application logic.<p>I started making SPAs in 2015 and I also used actions for everything (API calls, auth, etc). It was fine for small projects but then I got to work on a medium sized project and those actions became huge and controlled everything in my app. I usually consider myself a pragmatic person but that was impractical for a number of reasons and also conceptually wrong.<p>When working in SPAs now I remove anything that is not state management from MobX&#x2F;Vuex&#x2F;etc (I don&#x27;t use Redux anymore). That logic belongs somewhere else.<p>The pattern I&#x27;m doing now is that I conceptually separate components from the application logic. The store(s) feed data to the components but if the components want to interact with the application they go through a mediator of sorts (eg: changing a route, modifying state, authenticating, etc). This mediator then interacts and coordinates with the different application modules.<p>For example when authenticating many things have to happen in different modules (API, store, router):<p>1) An API call has to be made to verify credentials and receive a token<p>2) This token has be stored somewhere eg: localStorage<p>3) Maybe we also need to make an API call to get user info, their roles, etc<p>4) Some state in the store has to be modified. Not only the user info, but the app logic usually needs to know if a user is authenticated.<p>5) We need to tell the router to go to somewhere eg: &#x2F;home<p>It makes no sense to do all that in an action. Store actions should be about managing state, period.
评论 #22293042 未加载
评论 #22293291 未加载
评论 #22293027 未加载
Waterluvianover 5 years ago
I&#x27;m starting to lean towards holding ALL app state in a single store rather than having component local state because every so often I get burned by not seeing the future.<p>Example: okay I have a bunch of tabs that show different views. The state for which tab is selected can live with the tab container. Months later I find that I need other parts of the app to be able to switch to a different tab when user actions happen.<p>At this stage all I put in local state are the most basic things like dropdown open&#x2F;closed state.
评论 #22292283 未加载
评论 #22291710 未加载
评论 #22291605 未加载
评论 #22293963 未加载
评论 #22291774 未加载
评论 #22292422 未加载
adamklover 5 years ago
To manage state in our React application, we have a &quot;service layer&quot;, just like you’d see in a server side application, only these are based on state machines (reactive services based on RxJS observables works as well).<p>We also created associated custom hooks that allow developers to easily &quot;inject&quot; a service into their React component (we use React&#x27;s Context API for our &quot;DI container&quot;).<p>From there developers can read the service state to drive the look of the UI, or send events to it to trigger behaviour that is encapsulated in the service itself.<p>Our most used service is a UserSession service that manages OAuth based login flow and session management.<p>The best part of this approach is that our service layer started in an Angular based proof-of-concept before we lifted-and-shifted it all into React.<p>[1] <a href="https:&#x2F;&#x2F;xstate.js.org&#x2F;" rel="nofollow">https:&#x2F;&#x2F;xstate.js.org&#x2F;</a>
评论 #22293493 未加载
评论 #22291911 未加载
评论 #22293729 未加载
andrewstuartover 5 years ago
This post could more strongly emphasise something important to understand about writing ReactJS applications - taking a declarative approach to the overall application architecture.<p>Trying to write React applications in an imperative manner (the more traditional approach to programming as opposed to declarative), twisted my head in knots and made things harder and more complex than they needed to be.<p>What I mean by writing React applications in a declarative manner is:<p>1: you have a global state in your application<p>2: the global state includes an object with information about what state the application is in, for example:<p><pre><code> globalState = { &quot;DisplayingFormEditUserProfile&quot;: false, &quot;DisplayingFormViewUserProfile&quot;: true, &quot;DisplayingSideMenu&quot;: false, &quot;DisplayingTopBanner&quot;: true, &quot;DisplayingUserSignedInStatus&quot;: true, etc etc } </code></pre> 3: use React context to manage this state.<p>4: components decide to display themselves by querying the global state<p>It becomes easy then for your buttons and links to simply adjust the global state to make things happen. Because React rerenders the application each time the global state changes, you need do nothing explicit (imperative) to drive the application - it all just happens automatically as a result of what actions the user takes - actions that alter the global state.<p>React hooks and context make this approach very easy and clean to implement&#x2F;<p>That&#x27;s the way I do it anyway - an approach I find makes the entire application easier to understand.
评论 #22295614 未加载
rhackerover 5 years ago
I think the largest myth that exists in the react world is the need to have a global state for everything. I&#x27;ve seen too many failures when teams go from displaying &quot;this one thing&quot; to suddenly have the requirements to display two or more of that at the same time. Redux global state for the user that is logged in? that&#x27;s OK, but do you really need Redux for that?<p>Our team uses hooks and context for everything, and a little bit of legacy redux usage.
评论 #22293987 未加载
评论 #22291394 未加载
评论 #22291742 未加载
ChrisCinelliover 5 years ago
For state management I would start with reading &quot;Thinking in React&quot;: <a href="https:&#x2F;&#x2F;reactjs.org&#x2F;docs&#x2F;thinking-in-react.html" rel="nofollow">https:&#x2F;&#x2F;reactjs.org&#x2F;docs&#x2F;thinking-in-react.html</a><p>Step 3 is key. Step 4 is also important.<p>Then try to simplify the app as much as you can. A system has always 2 kind of complexity: the intrinsic complexity and incidental complexity. &quot;Smart engineers&quot; like to show off their intelligence. That usually end up making their life harder by adding a lot of incidental complexity that eventually lead to fragile architecture and frameworks that add more complexity than necessary.
评论 #22293810 未加载
评论 #22293802 未加载
danellisover 5 years ago
Why is state management such a talked-about issue with React? Other than distributed state, which obviously comes with its own set of challenges, managing state doesn&#x27;t seem to be an issue with any other language, framework or platform. But with React, it seems to be a major part of the learning curve, with entire tutorials dedicated to it and numerous libraries to help with it in some way.
评论 #22294351 未加载
评论 #22296793 未加载
评论 #22296406 未加载
the_optimistover 5 years ago
See also: Reagent. State is a first-class construct in Clojure&#x2F;script, and forms associated with statefulness and state management are directly available. From that perspective, none of the front-ends presented appear complex.<p><a href="https:&#x2F;&#x2F;github.com&#x2F;reagent-project&#x2F;reagent" rel="nofollow">https:&#x2F;&#x2F;github.com&#x2F;reagent-project&#x2F;reagent</a>
评论 #22291628 未加载
kerkeslagerover 5 years ago
&gt; For example, say your app has a dark mode. All your rendered components must know what theme is on, so they can render the UI in the right color.<p>Wait, what? Hell no. This is literally the core use case for CSS classes. And while there are cases where CSS classes can cause problems, this isn&#x27;t one of them. This is a case where CSS classes <i>shine</i>.<p>This is like an article on how to use fire to solve problems, and instead of choosing an example like staying warm or cooking food, the author leads with an example like disposing of tires by burning them in the rainforest. It&#x27;s just an unambiguously bad idea.<p>There were a bunch of places where I wasn&#x27;t familiar with the tools he&#x27;s using and am curious, but I&#x27;m certainly suspicious of anything he suggests after the &quot;use global state to reinvent CSS classes via JS&quot; suggestion.
评论 #22296066 未加载
rossmohaxover 5 years ago
I know nothing about state management on frontend, but please make supporting &quot;history back&quot;, &quot;history forward&quot; and &quot;F5 reload&quot; use cases easier. It seems to be a hard problem to crack, given how often these simple actions are broken
评论 #22294832 未加载
评论 #22303632 未加载
sytringy05over 5 years ago
Is it just me or does the state management &#x2F; prop-drilling thing sound just like a bog standard dependency injection problem?
nubbover 5 years ago
I’ve been learning React and have been avoiding Redux out of fear of complexity. However, as my app grows more complex, the need for a global state manager becomes more apparent. Time to start learning Redux today :)
评论 #22291377 未加载
评论 #22294056 未加载
评论 #22291121 未加载
评论 #22291013 未加载
评论 #22291545 未加载
评论 #22291240 未加载
评论 #22293363 未加载
评论 #22290947 未加载
评论 #22291118 未加载
评论 #22291007 未加载
SlowRobotAheadover 5 years ago
This is one area I have to give a huge tip of the hat to Flutter and Provider, BLoC pattern using streams (and transform streams!) and RX generally.<p>It&#x27;s been a lot easier to comprehend coming from C than the React options.
JoeOfTexasover 5 years ago
Shameless plug, but I created a dumbed down version of redux.<p><a href="https:&#x2F;&#x2F;github.com&#x2F;joetex&#x2F;flatstore&#x2F;" rel="nofollow">https:&#x2F;&#x2F;github.com&#x2F;joetex&#x2F;flatstore&#x2F;</a><p>Most of the difficulty with Redux is managing actions and reducers.<p>Out of the box, flatstore lets you get&#x2F;set from anywhere, with component &quot;connect&quot; function to trigger re-renders on data changes.<p>It&#x27;s probably only suited for smaller projects, but now you can prototype at the speed of light.
john-radioover 5 years ago
Help me out here. So state management refers to frontend tools like Redux and Vuex, and it sort of represents the &quot;backend of the frontend&quot; in that it defines constructs and their behaviors for the frontend to manipulate. Is that a correct understanding? If so then doesn&#x27;t it result in some bad code duplication between e.g. the Redux layer and the Django models?
评论 #22293917 未加载
评论 #22293904 未加载
评论 #22292894 未加载
评论 #22293852 未加载
评论 #22292495 未加载
wruzaover 5 years ago
May I ask React guys what’s wrong with parallel controller tree and (virtual) view tree which React tries to avoid (and, in my opinion, creates a bunch of in-club issues on a way that didn’t exist outside of its paradigm)?<p>I’m talking about this desktop mvc adapted to hyperscript approach:<p><pre><code> class AppCR extends CR { ctor() { this.db = new RemoteDB this.sidebar = new SidebarCR this.content = new ContentCR(db) this.val = {a:42, b:3.14, c:this.db.fetchC()} } render() { let {h, val} = this return h.div.wrapper(null, [ this.sidebar.render(), this.content.render(), h(AuxViewType1), h(AuxViewType2.model(this.val, &quot;c&quot;)), h.div(val.b), ]) } } class AuxViewType1 extends View { render() { let {h, cr} = this return h.span(cr.val.a) } } class AuxViewType2 extends View { render() { let {h, model} = this return h.model_input({model}) &#x2F;&#x2F; model == {object, key} (for &quot;input&quot;) } } </code></pre> Your controllers localize data, speak to the model in a non-ambigous way, provide data for views directly (no props, think view.cr and view.model works at any depth) and integrate other controllers by creating&#x2F;destroying them <i>explicitly</i> and rendering when they are needed.<p>You also may have a global read-only (mostly) store of reference data, but that’s more for caching large datasets, not for state sharing.<p>Btw, model_input could wait on a val.c promise and rerender appropriately without your intervention (something React folks were to deliver last year, supposedly with help from async setstate process, which was a requirement for that (why?)).<p>All of this React thing honestly feels like Haskell sneaked into an enterprise for the sake of “so cool we did it” giggles. Dan’s comments on this did not help much when I read ‘em.
评论 #22398109 未加载
brlewisover 5 years ago
Point 2 in this article says a global store is the solution to its example problem. If there are any details of the example problem that make a global store the best solution, those details are not given. Generally you store a component&#x27;s state in the component, and store shared state in a common ancestor of the components that share it.
评论 #22291709 未加载
rwieruchover 5 years ago
With the release of React Hooks and the advent of GraphQL + its client-side libraries, state management [0] became a blessing IMO. Whenever it&#x27;s possible I would opt-in using GraphQL for client-server communication. Then popular libraries like Apollo Client help you with all the state management for remote data and its caching. After this, all the remaining state management can be done with React Hooks (useState, useReducer, useContext)[1]. Only if this gets out of hands, opt-in Redux&#x2F;MobX&#x2F;...<p>- [0] <a href="https:&#x2F;&#x2F;www.robinwieruch.de&#x2F;react-state" rel="nofollow">https:&#x2F;&#x2F;www.robinwieruch.de&#x2F;react-state</a><p>- [1] <a href="https:&#x2F;&#x2F;www.robinwieruch.de&#x2F;react-state-usereducer-usestate-usecontext" rel="nofollow">https:&#x2F;&#x2F;www.robinwieruch.de&#x2F;react-state-usereducer-usestate-...</a>
thereyougoover 5 years ago
OP comment on Reddit:<p>&gt;<a href="https:&#x2F;&#x2F;old.reddit.com&#x2F;r&#x2F;javascript&#x2F;comments&#x2F;f1jop9&#x2F;6_things_i_wished_i_knew_about_state_management&#x2F;fh6oi33&#x2F;" rel="nofollow">https:&#x2F;&#x2F;old.reddit.com&#x2F;r&#x2F;javascript&#x2F;comments&#x2F;f1jop9&#x2F;6_things...</a>
hi41over 5 years ago
I am just a regular C&#x2F;C++ developer. When I read OP&#x27;s article, I was dismayed by the number of tools or frameworks he refers to. I wish to become a web&#x2F;app developer. How do I climb such a steep curve? Can someone please suggest a good online course.
评论 #22294126 未加载
bowlingxover 5 years ago
I used redux before switching to Apollo and a query parameters &#x2F; routing based state management. In Web Applications especially, it makes sense to couple global state to URLs. It makes the page and the current state shareable and brings value (like tabs, filters, pagination etc.). I developed a library based on zustand and immer for this case (called Geschichte). It’s open source <a href="https:&#x2F;&#x2F;github.com&#x2F;BowlingX&#x2F;geschichte" rel="nofollow">https:&#x2F;&#x2F;github.com&#x2F;BowlingX&#x2F;geschichte</a><p>Most of the use cases I can solve with that, the rest is usually either forms (covered by formik, final-form etc), async loading of data (Apollo) or local state and animations.
deanclatworthyover 5 years ago
Didn’t catch any mention of hooks in this article. My advice is only use redux when two components need access to the same information within a few seconds of whatever you are doing.<p>Otherwise I’d put all data fetching into hooks which can give any component which uses it access to all kinds of information and the ability to conditionally render.<p>I have found this pattern to be cleaner than using component lifecycle methods. An example can be seen here:<p><a href="https:&#x2F;&#x2F;github.com&#x2F;deanc&#x2F;buyxiny.com&#x2F;blob&#x2F;master&#x2F;site&#x2F;src&#x2F;components&#x2F;ItemList.js" rel="nofollow">https:&#x2F;&#x2F;github.com&#x2F;deanc&#x2F;buyxiny.com&#x2F;blob&#x2F;master&#x2F;site&#x2F;src&#x2F;co...</a>
sonecaover 5 years ago
Ok, only tangentially related. I would appreciate anyone more knowledgeable than me in React chipping in: Why Redux is the norm for React state management?<p>Follow-up specific question: In which cases is it better than react-easy-state[0]?<p>I am using react-easy-state on my company and on my side-project web apps. For me at least, it seems to add much less cognitive overhead than Redux. It is simpler to understand, simpler to use, simpler to read and maintain.<p>Am I missing anything? Because react-easy-state seems very underrated in my opinion.<p>[0] <a href="https:&#x2F;&#x2F;github.com&#x2F;RisingStack&#x2F;react-easy-state" rel="nofollow">https:&#x2F;&#x2F;github.com&#x2F;RisingStack&#x2F;react-easy-state</a>
评论 #22292604 未加载
评论 #22292615 未加载
评论 #22304111 未加载
elliusover 5 years ago
Bounced around 2 projects in the last 12 months, one Angular and one React, that are using the Flux pattern. It is a real bitch to unit test anything but the individual pieces, which ends up being kind of meaningless.
评论 #22293931 未加载
评论 #22292217 未加载
评论 #22291589 未加载
reilly3000over 5 years ago
I haven&#x27;t seen much mention of Apollo here. It offers a &#x27;full stack&#x27; state management solution from server to client to offline cache. Each component can be adopted independently, but they work really nicely together. The tradeoff is that you&#x27;re writing graphql, but it comes along with a lot of benefits, like consolidating requests etc. On the server-side, graphql can be a thin wrapper over rest apis. Defining good schemas can be a bit of a pain, but they maintain a level of consistency throughout the system as it grows.
评论 #22304130 未加载
jkleiserover 5 years ago
Great article! I have only done a few simple projects with React, except for one where we used Redux. For me, Redux is too much clutter. I can recommend a look at this article: <a href="https:&#x2F;&#x2F;medium.com&#x2F;@yiyisun&#x2F;redux-vs-the-react-context-api-vs-apprun-f324bee8cbbf" rel="nofollow">https:&#x2F;&#x2F;medium.com&#x2F;@yiyisun&#x2F;redux-vs-the-react-context-api-v...</a> I&#x27;ve been working on an AppRun based hobby project for a couple of months now, and I find state management there to be quite easy. No clutter!
alfonmgaover 5 years ago
I&#x27;m in the process of building a B2B multi-tenant SaaS application and one of the best decisions I made so far was to use Easy Peasy [0] to handle the state of my React application logic. It has a very intuitive and powerful API. I would recommend everyone to take it a look as it is not very known.<p>[0] <a href="https:&#x2F;&#x2F;github.com&#x2F;ctrlplusb&#x2F;easy-peasy" rel="nofollow">https:&#x2F;&#x2F;github.com&#x2F;ctrlplusb&#x2F;easy-peasy</a>
diseaseover 5 years ago
&gt; URL state: the route the user is on now. Read and update window.location; don’t create a second source of truth<p>I&#x27;ve seen so much back and forth on this issue during my time developing with React. Intuitively, it seems like the URL should be treated the same way that DOM elements are: as a source of actions that may or may not result in state change - in addition to a reflection of state.
jeffadotioover 5 years ago
I have abandoned all of the JavaScript state management libraries and now prefer to simply write my own storage module using Meiosis[1] and a tiny library for operating streams. This replaces tech debt and repetitious boilerplate code with simple, meaningful and functional code.<p><a href="http:&#x2F;&#x2F;meiosis.js.org&#x2F;" rel="nofollow">http:&#x2F;&#x2F;meiosis.js.org&#x2F;</a>
nojvekover 5 years ago
This post is overly complex in its suggestion of libraries. He does have a good point of understanding different kinds of state and that state management in front end is perhaps the hardest problem. If you think about it well earlier, a lot of things become easier as you scale.
评论 #22304078 未加载
mfrye0over 5 years ago
For anyone not familiar with UI app design, you do not need to always default to a Redux or Mobx. I&#x27;ve found a simple object &#x2F; class with an event emitter will suffice for many cases.
评论 #22291631 未加载
jaimex2over 5 years ago
Been using alt.js for ages and continued to make use of it in React, never really ran into the issues described.<p>Use it as a store or cache that alerts all your components of data changes, works well enough.
评论 #22304147 未加载
reggiebandover 5 years ago
&gt; but you do need to figure out how to store global state that can be accessed anywhere in your application.<p>Immediately I disagree and feel antagonistic towards this article.<p>Then the author provides an example of &quot;prop drilling&quot;. Sounds an awful lot like Inversion of Control [1]. I&#x27;ve been down this road before. Next comes a Services pattern [2] (the world re-invents COM once again) and then comes Dependency Injection [3]. What he calls &quot;global state&quot; others have called &quot;cross-cutting concerns&quot; [4]. Pretty soon we&#x27;ll be all aspect-oriented-programming [5] up in here.<p>&gt; What you need to do is store your theme setting in a Redux or MobX store, or in a plain JavaScript object, and pass it to all your components using Context.<p>Yup. The beginning of a services pattern by changing to inversion of control. Once you realize you don&#x27;t want all of your state on a single object you&#x27;ll have `context.getUser` and `context.getTheme` and then you&#x27;ll think having specific functions is a pain so you&#x27;ll have `context.get(ContextType.User)`. Then you&#x27;ll have interfaces so you can easily unit test with mock services.<p>This is all good stuff. Keep going down that road.<p>1. <a href="https:&#x2F;&#x2F;en.wikipedia.org&#x2F;wiki&#x2F;Inversion_of_control" rel="nofollow">https:&#x2F;&#x2F;en.wikipedia.org&#x2F;wiki&#x2F;Inversion_of_control</a><p>2. <a href="https:&#x2F;&#x2F;en.wikipedia.org&#x2F;wiki&#x2F;Service_layer_pattern" rel="nofollow">https:&#x2F;&#x2F;en.wikipedia.org&#x2F;wiki&#x2F;Service_layer_pattern</a><p>3. <a href="https:&#x2F;&#x2F;en.wikipedia.org&#x2F;wiki&#x2F;Dependency_injection" rel="nofollow">https:&#x2F;&#x2F;en.wikipedia.org&#x2F;wiki&#x2F;Dependency_injection</a><p>4. <a href="https:&#x2F;&#x2F;en.wikipedia.org&#x2F;wiki&#x2F;Cross-cutting_concern" rel="nofollow">https:&#x2F;&#x2F;en.wikipedia.org&#x2F;wiki&#x2F;Cross-cutting_concern</a><p>5. <a href="https:&#x2F;&#x2F;en.wikipedia.org&#x2F;wiki&#x2F;Aspect-oriented_software_development" rel="nofollow">https:&#x2F;&#x2F;en.wikipedia.org&#x2F;wiki&#x2F;Aspect-oriented_software_devel...</a>
评论 #22293575 未加载
jrochkind1over 5 years ago
Is MobX catching on?
评论 #22292787 未加载
k__over 5 years ago
I don&#x27;t even use any of these state libraries.<p>All logic in the page&#x2F;screen components and the prop-drill them down to where they are displayed.
评论 #22294018 未加载
brlewisover 5 years ago
In other comments I&#x27;ve pointed out specific major flaws in this article, but for whatever reason it continues to be upvoted and has risen to number 6.<p>To be clear, this article is not useful. If you are trying to learn about state management in React, do not read it. Read this one: <a href="https:&#x2F;&#x2F;kentcdodds.com&#x2F;blog&#x2F;application-state-management-with-react" rel="nofollow">https:&#x2F;&#x2F;kentcdodds.com&#x2F;blog&#x2F;application-state-management-wit...</a>