<story><title>Things I wish I knew about state management when I started writing React apps</title><url>https://medium.com/@veeralpatel/things-ive-learned-about-state-management-for-react-apps-174b8bde87fb</url></story><parent_chain><item><author>the_gastropod</author><text>I&amp;#x27;m one of those &amp;quot;old dogs&amp;quot; who don&amp;#x27;t quite get the advantage of using React in the majority of the cases it&amp;#x27;s used. This article didn&amp;#x27;t really help...&lt;p&gt;&amp;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.&lt;p&gt;Back in my day.... you&amp;#x27;d slap a class on the &amp;lt;body&amp;gt; tag, and you&amp;#x27;d have all you&amp;#x27;d need for your CSS to style the rest of the page accordingly. How is using Redux an improvement here?&lt;p&gt;None of the examples of &amp;quot;complex&amp;quot; front-ends would be at all difficult in an old-school &amp;quot;just re-render the page&amp;quot; setup using something like pjax or turbolinks. And in my experience (seeing web pages with &amp;gt; 1MB js files) it&amp;#x27;d be faster&amp;#x2F;more responsive for the end-user too.</text></item></parent_chain><comment><author>jfengel</author><text>React and Redux are for apps. If you can do it with HTML&amp;#x2F;CSS, you absolutely should.&lt;p&gt;React&amp;#x2F;Redux are a replacement for what people used to do with jquery or plain JS. They&amp;#x27;re not for display; they&amp;#x27;re for complex interaction of the kind that used to require a native user interface (Java Swing, Gtk, Win32, etc). Javascript is a mess, and the DOM is a mess; React makes that slightly less awful. (Redux is an extension to React to help manage global state; again, it&amp;#x27;s compensating for just how bad Javascript is.)&lt;p&gt;Bonus: React encourages the use of JSX, a language that makes a lot of behavior look as if you were writing it directly in HTML. You don&amp;#x27;t need React to use JSX, and you don&amp;#x27;t need JSX to use React, but they do dovetail nicely.&lt;p&gt;You can write in plain JS&amp;#x2F;jquery if you want. Plenty of people do. React is a framework to make that a bit easier; that&amp;#x27;s all.</text></comment>
<story><title>Things I wish I knew about state management when I started writing React apps</title><url>https://medium.com/@veeralpatel/things-ive-learned-about-state-management-for-react-apps-174b8bde87fb</url></story><parent_chain><item><author>the_gastropod</author><text>I&amp;#x27;m one of those &amp;quot;old dogs&amp;quot; who don&amp;#x27;t quite get the advantage of using React in the majority of the cases it&amp;#x27;s used. This article didn&amp;#x27;t really help...&lt;p&gt;&amp;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.&lt;p&gt;Back in my day.... you&amp;#x27;d slap a class on the &amp;lt;body&amp;gt; tag, and you&amp;#x27;d have all you&amp;#x27;d need for your CSS to style the rest of the page accordingly. How is using Redux an improvement here?&lt;p&gt;None of the examples of &amp;quot;complex&amp;quot; front-ends would be at all difficult in an old-school &amp;quot;just re-render the page&amp;quot; setup using something like pjax or turbolinks. And in my experience (seeing web pages with &amp;gt; 1MB js files) it&amp;#x27;d be faster&amp;#x2F;more responsive for the end-user too.</text></item></parent_chain><comment><author>some-guy</author><text>For individuals making small sites, it&amp;#x27;s absolutely overkill.&lt;p&gt;For my job, with hundreds of developers working on a giant SPA blob with constant feature creep, frameworks like React are a necessary evil to maintain the insanity.</text></comment>