<?xml version="1.0" encoding="UTF-8"?><rss xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:content="http://purl.org/rss/1.0/modules/content/" xmlns:atom="http://www.w3.org/2005/Atom" version="2.0" xmlns:cc="http://cyber.law.harvard.edu/rss/creativeCommonsRssModule.html">
    <channel>
        <title><![CDATA[Stories by Sofia Marques on Medium]]></title>
        <description><![CDATA[Stories by Sofia Marques on Medium]]></description>
        <link>https://medium.com/@sofia_marques?source=rss-f39bc61e24fb------2</link>
        <image>
            <url>https://cdn-images-1.medium.com/fit/c/150/150/1*4n3AweYAsbuoXTS-5n1lgw.png</url>
            <title>Stories by Sofia Marques on Medium</title>
            <link>https://medium.com/@sofia_marques?source=rss-f39bc61e24fb------2</link>
        </image>
        <generator>Medium</generator>
        <lastBuildDate>Wed, 02 Dec 2026 11:07:04 GMT</lastBuildDate>
        <atom:link href="https://medium.com/@sofia_marques/feed" rel="self" type="application/rss+xml"/>
        <webMaster><![CDATA[yourfriends@medium.com]]></webMaster>
        <atom:link href="http://medium.superfeedr.com" rel="hub"/>
        <item>
            <title><![CDATA[I generated a custom React course in minutes (and it actually worked)]]></title>
            <link>https://medium.com/@sofia_marques/i-generated-a-custom-react-course-in-minutes-and-it-actually-worked-43a9a0ce16db?source=rss-f39bc61e24fb------2</link>
            <guid isPermaLink="false">https://medium.com/p/43a9a0ce16db</guid>
            <category><![CDATA[react]]></category>
            <category><![CDATA[ai]]></category>
            <dc:creator><![CDATA[Sofia Marques]]></dc:creator>
            <pubDate>Thu, 30 Jul 2026 18:53:41 GMT</pubDate>
            <atom:updated>2026-07-30T18:53:41.138Z</atom:updated>
            <content:encoded><![CDATA[<figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/0*e7fwENBAFV3IcCo9" /></figure><p>I have opened the same React Server Components tutorial so many times that my browser autocompletes the URL after I type two letters. I have never once finished it. It is six hours long, it assumes I am starting from a blank Next.js app, and the twenty minutes I actually need are buried somewhere in module nine, behind an hour of material I already know cold.</p><p>So last week I stopped trying to finish someone else’s course and generated my own instead.</p><h3>The course I couldn’t find</h3><p>The problem was never a shortage of React material. There is too much of it, and almost none of it is aimed at me specifically. The free tutorials assume you have never written a component. The deep dives assume you already ship Server Components for a living. And a surprising amount of it still teaches React 18 patterns, even though React 19 shipped form actions, `useActionState`, and the `use` hook, and quietly changed how a lot of this works day to day. (The <a href="https://react.dev/blog/2024/12/05/react-19">React 19 release notes</a> are worth reading start to finish if you skimmed them like I did.)</p><p>What I wanted was narrow. Ninety minutes, maybe less, covering four things: the mental model behind <a href="https://react.dev/reference/rsc/server-components">Server Components</a>, when to reach for `use`, how server actions replace the API route I keep writing by hand, and the one thing that actually trips me up, which is where the boundary between server and client really sits. Nobody sells that course, because it is a course for exactly one person.</p><h3>What ten minutes actually produced</h3><p>I typed those four gaps into an instant course generation tool called <a href="http://fenzo.ai">Fenzo</a> and got back a course that looked like someone had skimmed my browser history.</p><p>Instead of starting with JSX or React fundamentals, the first lesson opened with the server/client rendering model. The next one focused entirely on the use hook. Then came server actions, React 19 form actions, and finally the client/server boundary that I keep second-guessing every time I add a &#39;use client&#39; directive.</p><p>Every lesson was short. Each one ended with a question or a small coding exercise before moving on. If I got something wrong, it stopped and explained why before continuing. The point was not to consume another six hours of React content. It was to build the smallest course that could close <em>my</em> specific gaps. Fenzo generates these courses from a prompt or even your own notes, organizing them into bite-sized lessons with quizzes and interactive exercises instead of one long AI response.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*J2xgn-y0SlyMHevziHFtLA.png" /></figure><p>That turned out to matter more than I expected.</p><p>Normally, I treat tutorials like Netflix. I watch someone else solve problems, nod along, and convince myself I understand because everything feels familiar while I’m looking at it. This forced me to stop every few minutes and prove I actually knew the answer before it would let me move on.</p><p>That was the moment the learning actually started.</p><h3>Why being wrong on purpose worked</h3><p>Getting a question wrong taught me more than reading the right answer five times over. There is a name for this, and it is well studied: the <a href="https://en.wikipedia.org/wiki/Testing_effect">testing effect</a>. The act of dragging an answer out of your own head strengthens the memory far more than re-reading the material does. Recognition is cheap. Retrieval is the part that lasts.</p><p>I got the `’use client’` question wrong. I put the directive on the wrong side of the boundary, the course told me so, and I have not made that mistake since. Reading the correct version had never once burned it in. Being caught out did, in a single try. That is not a fact about the software. It is a fact about how memory works, and I had been fighting it for years by only ever consuming.</p><p>The practical takeaway is smaller than any tool and survives without one: build the quiz into your own learning. Close the tab after a section and write the code from memory. Explain the idea out loud to nobody in particular. If you use something that forces the retrieval for you, good, but the forcing is the point, not the product.</p><h3>Where I am taking this next</h3><p>I trust all of this slightly less than I should, for one reason. I know React well enough to catch the generator when it slips. The stale data-fetching sample did not fool me, and the boundary explanation lined up with what I already half-understood. The question I cannot answer yet is what happens when I generate a course on something I have no instinct for, where I could not tell a confident wrong answer from a correct one.</p><p>So that is the next experiment. I am going to generate a course on Rust compiled to WebAssembly, a corner of the web I have avoided even harder than Server Components, and see whether being quizzed catches me when I have nothing of my own to check the answers against. I will report back, wrong answers included.</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=43a9a0ce16db" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Why data fetching is a UI problem (not an API problem)]]></title>
            <link>https://medium.com/@sofia_marques/why-data-fetching-is-a-ui-problem-not-an-api-problem-2579682d8ac6?source=rss-f39bc61e24fb------2</link>
            <guid isPermaLink="false">https://medium.com/p/2579682d8ac6</guid>
            <category><![CDATA[web-development]]></category>
            <category><![CDATA[react]]></category>
            <dc:creator><![CDATA[Sofia Marques]]></dc:creator>
            <pubDate>Tue, 03 Mar 2026 03:55:11 GMT</pubDate>
            <atom:updated>2026-03-03T03:55:11.021Z</atom:updated>
            <content:encoded><![CDATA[<p>For a long time, I viewed data fetching as an API problem. You call an endpoint, get JSON back, and render it. That mental model felt clean and reassuring. It also made me think that once the API call worked, my job was basically done.</p><p>In real applications, that framing quickly showed its limits. The issue was not the API itself, but everything that happened before, after, and in between the arrival of the data.</p><p>Data fetching includes how the interface behaves when data is missing, partial, stale, or wrong. This behavior belongs to the UI.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*F-gDcxjjpcxNq0_-WMZiaA.jpeg" /></figure><h3>The model that looks right and fails quietly</h3><p>Early in my <a href="https://www.educative.io/courses/learn-react?utm_campaign=persona_web_dev_q1_26&amp;utm_source=medium&amp;utm_medium=text&amp;utm_content=sofia_persona_march&amp;utm_term=&amp;eid=5082902844932096">React learning</a>, my components followed a familiar rhythm. Fetch on mount; render when the data arrives. When the data did not exist yet, I returned a spinner and moved on.</p><pre>useEffect(() =&gt; {<br>  fetchUser().then(setUser);<br>}, []);</pre><p>Somewhere else in the component, loading was handled almost casually.</p><pre>if (!user) {<br>  return &lt;Spinner /&gt;;<br>}</pre><p>That single line hides several design decisions. What does the user see while waiting? Does the layout jump when content appears? Is the spinner replacing a meaningful structure, or is it merely reserving space for it?</p><p>Once I noticed this, loading stopped feeling like a technical detail and started feeling like a user-facing state. Making the state explicit helped clarify that shift.</p><pre>type RequestState&lt;T&gt; =<br>  | { status: &quot;loading&quot; }<br>  | { status: &quot;success&quot;; data: T }<br>  | { status: &quot;error&quot;; error: Error };</pre><p>With that structure in place, the UI is forced to be intentional, even in simple cases where I would normally reach for a boolean and move on. This is a straightforward case of <a href="https://react.dev/learn/conditional-rendering">conditional rendering</a> in React.</p><pre>if (state.status === &quot;loading&quot;) {<br>  return &lt;ProfileSkeleton /&gt;;<br>}<br><br>if (state.status === &quot;error&quot;) {<br>  return &lt;ProfileError /&gt;;<br>}<br><br>return &lt;UserProfile data={state.data} /&gt;;</pre><p>At that point, loading stopped being a boolean and became a design problem. Whether a skeleton mirrors the final layout or previously loaded data remains visible, those decisions do not come from the API.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*EFaJ2jH1BMae7kAgGtVHYQ.jpeg" /></figure><p><strong>Empty data is still a valid state</strong></p><p>Another early assumption I had was that empty data meant something had gone wrong. An empty array felt like a failure.</p><p>In reality, empty data often means the system is working as intended. A new account, a cleared inbox, or a filter with no matching results can all produce empty responses.</p><p>The API has done its job. The UI now has to explain what that absence means by setting expectations and clarifying what the user is looking at and what their next step might be.</p><h3>Errors deserve design attention</h3><p>Errors are not rare edge cases. I learned this the hard way in a sprint where a token expired mid-session, and the UI just froze.</p><p>When error states are not designed intentionally, users are left with frozen spinners or broken layouts. A clear error message with calm language and a visible recovery path feels far more trustworthy.</p><pre>if (state.status === &quot;error&quot;) {<br>  return (<br>    &lt;ErrorState<br>      message=&quot;We could not load your profile.&quot;<br>      onRetry={refetch}<br>    /&gt;<br>  );<br>}</pre><p>The most important choices here are about tone, context, and whether the user can recover without losing their place. Those decisions live entirely in the UI layer. A retry button is useful, but clarity and reassurance usually matter more.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*xdyWlsXyadcQfGyTJRk6Wg.jpeg" /></figure><h3>Transitions shape the experience</h3><p>One of the more subtle lessons was realizing that correct data does not guarantee a good experience. The way the UI moves between states matters just as much.</p><p>I have built pages where refetches caused the screen to flash, collapse, or jump, even though the data was correct. Keeping previous data visible during updates reduced that instability.</p><p>Tools like React Query make this easier, but the design decision exists regardless of library choice.</p><pre>const { data, isFetching } = useQuery(<br>  [&quot;todos&quot;],<br>  fetchTodos,<br>  { keepPreviousData: true }<br>);</pre><p>With this approach, the interface remains visually stable while new data loads in the background. <a href="https://tanstack.com/query/latest/docs/framework/react/guides/paginated-queries">Libraries</a> that support keeping previous data during refetches make this pattern easier to implement.</p><h3>Partial data is often enough</h3><p>“Fetch then render” assumes completeness. Real interfaces rarely operate that way.</p><p>Some information matters immediately, while other parts can arrive later. Showing key content first can make an application feel responsive even when the network is slow.</p><p>Rather than waiting for everything to be ready, <a href="https://react.dev/reference/react/Suspense">React Suspense</a> allows the UI to be honest about what it has, what it is waiting for, and what the user should see first.</p><pre>&lt;UserHeader user={user} /&gt;<br>&lt;Suspense fallback={&lt;PostsSkeleton /&gt;}&gt;<br>  &lt;UserPosts userId={user.id} /&gt;<br>&lt;/Suspense&gt;</pre><p>Here, the UI is making a prioritization decision. The user’s identity and surrounding context are rendered immediately, while the posts are treated as secondary and allowed to load later. The API simply provides data; it does not understand hierarchy, focus, or what the user needs first. React Suspense makes this kind of partial rendering explicit.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*Aa8HxHBZYpEP1-HHDOG_Iw.jpeg" /></figure><h3>Why “fetch then render” is not enough</h3><p>“Fetch then render” answers how data arrives. It does not address what the user experiences while waiting, what happens when something fails, or how the interface behaves as data changes.</p><p>Those questions are answered through layout, transitions, copy, and state modeling. They are UI decisions layered on top of data access.</p><p>The API provides the ingredients. The UI decides how they are presented.</p><h3>A practical takeaway</h3><p>Treat data fetching as an integral part of interface design, not just a technical step.</p><p>When loading, empty, error, and partial states are designed with intention, the application feels calmer and more reliable. Users may not consciously notice why, but they feel the difference.</p><p>That shift, from treating data fetching as an API concern to treating it as a UI responsibility, changed how I build React interfaces more than any specific library or hook.</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=2579682d8ac6" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[React components are a mental model, not a file structure]]></title>
            <link>https://medium.com/@sofia_marques/react-components-are-a-mental-model-not-a-file-structure-6c57ab9d64c4?source=rss-f39bc61e24fb------2</link>
            <guid isPermaLink="false">https://medium.com/p/6c57ab9d64c4</guid>
            <category><![CDATA[web-development]]></category>
            <category><![CDATA[react]]></category>
            <dc:creator><![CDATA[Sofia Marques]]></dc:creator>
            <pubDate>Mon, 02 Mar 2026 04:54:23 GMT</pubDate>
            <atom:updated>2026-03-02T04:54:23.922Z</atom:updated>
            <content:encoded><![CDATA[<p>One of the first things I tried to get right in React was the folder structure.</p><p>I reorganized the components three times in one week. Once by feature, once by UI type, and once by screen. I convinced myself that once the directories looked clean, the code would feel clean too.</p><p>It did not.</p><p>What eventually clicked was that React components are not primarily about where code lives. They are about what a piece of UI is responsible for. Until that distinction became clear, component design felt arbitrary, and refactors felt constant.</p><p>This post is about why folder-based thinking breaks down in React and how thinking in terms of ownership brings clarity.</p><h3>The common misconception: Components as containers</h3><p>Early on, it is easy to treat components as containers for markup and styles.</p><p>A structure like this feels reassuring:</p><pre>components/<br>  Button/<br>    Button.jsx<br>    Button.css<br>  Modal/<br>    Modal.jsx<br>    Modal.css<br>  Profile/<br>    Profile.jsx<br>    Profile.css</pre><p>Nothing here is wrong. It is tidy. It looks intentional.</p><p>The problem is what this structure encourages you to think about. When components are framed as folders, it is easy to start treating architectural decisions as placement questions. Should this logic live in Profile or in a child component? Should this state move up a level? Should this even be its own component?</p><p>Those questions feel like file organization problems, but they are not. A directory tree can tell you where code lives, but it cannot tell you which part of the UI should own a piece of behavior or data.</p><p>That distinction matters in React. The framework does not care where a component lives on disk. It cares which component is responsible for the data, interactions, and rendering involved.</p><p>This was the point where I stopped arguing with my components and started noticing what they were pushing back on.</p><h3>Components as responsibility boundaries</h3><p>The shift that helped most was reframing components as responsibility boundaries rather than visual groupings.</p><p>A component owns:</p><ul><li>The data it depends on.</li><li>The events that can change that data.</li><li>The rendering that reflects those changes.</li></ul><p>In practice, ownership means this is where the state and logic live.</p><p>When all three live together, the component feels stable. When they are split arbitrarily, friction shows up quickly.</p><p>The React documentation emphasizes this same idea in its discussion of component design and state ownership, particularly in the section on<a href="https://react.dev/learn/thinking-in-react"> thinking in React</a>.</p><p>Consider a simple input component.</p><pre>function SearchInput({ value, onChange }) {<br>  return (<br>    &lt;input<br>      value={value}<br>      onChange={(e) =&gt; onChange(e.target.value)}<br>    /&gt;<br>  );<br>}</pre><p>This component renders UI but owns nothing about its behavior. That might be correct, but only if the responsibility truly belongs elsewhere, such as when a parent component owns the state and logic by design, rather than by default. This usually makes sense only when multiple parts of the UI need the same value.</p><p>Early on, I defaulted to patterns like this without asking why. The result was components that existed mostly to pass props around. They were reusable in theory and awkward in practice.</p><p>The better question turned out not to be “<em>Can this be reused</em>?” but “<em>Who actually owns this behavior</em>?”</p><h3>Why folder-based thinking fails</h3><p>Folder-based thinking assumes hierarchy equals architecture. In React, that assumption quickly falls apart.</p><p>Two components can live side by side and have completely different responsibilities. Two components can live far apart and still be tightly coupled through shared state or effects.</p><p>This is why reorganizing files rarely fixes design problems. If state ownership is unclear, the discomfort will resurface as prop drilling (passing props through components that don’t use them), unexpected re-renders, or components that feel brittle to change.</p><p>React surfaces these issues early by forcing ownership decisions. The state must live somewhere. Effects must run somewhere. Data must flow in a direction. When those decisions are unclear, the code pushes back.</p><p>That pushback is not a failure of the code organization. It is feedback about how the mental model is being applied. In my case, it showed up as props being passed through components that didn’t actually care about them. The React documentation frames this tension explicitly in its discussion of<a href="https://react.dev/learn/sharing-state-between-components"> lifting state up</a> (moving shared state to the closest common parent), where questions of ownership determine whether components feel cohesive or awkwardly coupled.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*0rLvqqGT6K1c1bWV8nifHQ.png" /></figure><p>The file structure shown here is illustrative. Component responsibilities do not need to map one-to-one to folders or files.</p><h3>How React wants you to think about ownership</h3><p>The most useful shift was to stop starting with folders and start with questions.</p><ul><li>Who owns this state?</li><li>Who is allowed to change it?</li><li>Who needs to react when it changes?</li></ul><p>The component that answers all three is usually the right boundary.</p><p>Once that boundary is clear, file structure becomes secondary. Files can be colocated for convenience, split for readability, or reorganized later without changing the underlying design.</p><p>This is also why React emphasizes data flow. Clear ownership leads to predictable updates. Unclear ownership leads to components leaking responsibility into one another.</p><p>The goal is not fewer components or more components. The goal is components that make sense as units of responsibility.</p><p>Resources like Educative’s <a href="https://www.educative.io/courses/learn-react?utm_campaign=persona_web_dev_q1_26&amp;utm_source=medium&amp;utm_medium=text&amp;utm_content=sofia_persona_march&amp;utm_term=&amp;eid=5082902844932096">Learn React</a> material reinforce this kind of boundary thinking through concrete examples of state ownership in practice.</p><h3>From structure to clarity</h3><p>Once this clicked, several things changed at once.</p><p>Components became easier to name, because they described what they owned rather than how they looked. Refactors became smaller, because responsibilities were clearer. Folder structures became simpler, because they stopped carrying architectural weight.</p><p>React components are not folders with JSX inside them. They are contracts about ownership in your UI. That is, they define where the state lives, where logic runs, and where changes are reflected. Kent C. Dodds has written extensively about this idea in the context of <a href="https://kentcdodds.com/blog/colocation">component design and composition</a>, particularly around keeping state close to where it is used.</p><p>If component design has felt frustrating, it is often because a mental model problem is being solved with a file system solution. Adjust the framing, and much of that friction fades.</p><p>The next time you reach for a new folder, pause and ask: <em>Who should actually own this?</em></p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=6c57ab9d64c4" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Why most React bugs are design bugs, not code bugs]]></title>
            <link>https://medium.com/@sofia_marques/why-most-react-bugs-are-design-bugs-not-code-bugs-91a626bfa66e?source=rss-f39bc61e24fb------2</link>
            <guid isPermaLink="false">https://medium.com/p/91a626bfa66e</guid>
            <category><![CDATA[web-development]]></category>
            <category><![CDATA[react]]></category>
            <dc:creator><![CDATA[Sofia Marques]]></dc:creator>
            <pubDate>Wed, 25 Feb 2026 03:55:39 GMT</pubDate>
            <atom:updated>2026-02-25T03:55:39.181Z</atom:updated>
            <content:encoded><![CDATA[<p>I have a confession to make.</p><p>Early in my career, I spent three days fixing the same bug.</p><p>It was a UserProfile component. Every time a user navigated away and came back quickly, the app would crash or show stale data. I kept hunting for a syntax error, checking imports and dependencies obsessively, convinced I’d just missed a comma or a bracket. I scoured the code for missing semicolons. I obsessed over the dependency array in useEffect. I even rewrote the entire fetch function.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*yPbEVYJqQxhbwc-v104KOw.png" /></figure><p>The code was syntactically perfect. There were no typos. And yet, the bug persisted, causing crashes in nearly 10 percent of our user sessions.</p><p>That is when I realized I was not fighting the code. I was fighting a bad design.</p><p>My component was trying to fetch data, format dates, validate user permissions, and manage UI state at the same time. It wasn’t a simple coding mistake. The problem ran deeper. It was the way the component was built.</p><p>We often think of bugs as broken code. But in React, the stickiest bugs are usually symptoms of broken design.</p><h3>Symptoms vs. root causes</h3><p>When you see an error message in the console, it is easy to panic and start patching lines of code. But that is like trying to fix a leaky faucet when the real problem is that the pipes are routed through the living room wall instead of the bathroom.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*7tnau6jcdw20Iyrh3lO6ig.png" /></figure><p>A <strong>code bug</strong> is a typo or a syntax error. It is easy to find and easy to fix.</p><p>A <strong>design bug</strong> occurs when data flows in the wrong direction or a component knows too much about the system around it. These bugs are silent killers. They don’t always throw errors immediately, but they make your app rigid and fragile.</p><p>If you find yourself fixing the same component over and over, stop looking at the syntax. Look at the structure.</p><h3>Trap 1: The multipurpose component</h3><p>The most common design bug I started noticing was the component that does too much.</p><p>We have all written this component. It starts as a simple button. Then we add a loading state. Then we add an API call. Then we add validation logic. Suddenly, your simple button is handling the entire business logic of the checkout process.</p><p>In React terms, this violates the Single Responsibility Principle. When you mix fetching logic with rendering logic, you create a tangled mess where a change in one breaks the other.</p><p>Here is what that multipurpose component usually looks like:</p><pre>// The &quot;Bad&quot; Design: Everything is mixed together<br>function UserProfile({ userId }) {<br>  const [user, setUser] = useState(null);<br>  const [loading, setLoading] = useState(true);<br>  const [error, setError] = useState(null);<br><br>  useEffect(() =&gt; {<br>    // Fetching logic inside the UI component?<br>    // Hard to test, hard to reuse.<br>    fetch(`/api/users/${userId}`)<br>      .then((res) =&gt; res.json())<br>      .then((data) =&gt; {<br>        // Formatting logic mixed with state updates?<br>        const formattedDate = new Date(data.joinedAt).toLocaleDateString();<br>        setUser({ ...data, joinedAt: formattedDate });<br>        setLoading(false);<br>      })<br>      .catch((err) =&gt; setError(err));<br>  }, [userId]);<br><br>  if (loading) return &lt;Spinner /&gt;;<br>  if (error) return &lt;ErrorMessage /&gt;;<br><br>  return (<br>    &lt;div className=&quot;card&quot;&gt;<br>      &lt;h1&gt;{user.name}&lt;/h1&gt;<br>      &lt;p&gt;Member since: {user.joinedAt}&lt;/p&gt;<br>    &lt;/div&gt;<br>  );<br>}</pre><p>Think of a restaurant kitchen. In a well-designed system, you have a Chef (the logic) and a Waiter (the UI). The code above is a restaurant where the Chef is trying to cook, park cars, and wait tables at the same time. If the valet gets busy parking a car, the food burns.</p><p><strong>The fix:</strong> Split the logic from the UI. By moving the thinking part into a custom Hook, the component becomes purely about showing data.</p><pre>// The &quot;Good&quot; Design: Logic is separated from UI<br><br>// 1. The Logic (The Chef)<br>function useUser(userId) {<br>  const [user, setUser] = useState(null);<br>  const [loading, setLoading] = useState(true);<br>  const [error, setError] = useState(null);<br><br>  useEffect(() =&gt; {<br>    // **Pro tip: In a real app, consider adding an AbortController here**<br>    // **to cancel stale requests if the userId changes quickly.**<br>    setLoading(true);<br>    fetch(`/api/users/${userId}`)<br>      .then((res) =&gt; res.json())<br>      .then((data) =&gt; {<br>        setUser(data);<br>        setLoading(false);<br>      })<br>      .catch((err) =&gt; {<br>        setError(err);<br>        setLoading(false);<br>      });<br>  }, [userId]);<br><br>  return { user, loading, error };<br>}<br><br>// 2. The UI (The Waiter)<br>function UserProfile({ userId }) {<br>  // The component asks for data, but doesn&#39;t care HOW it&#39;s fetched<br>  const { user, loading, error } = useUser(userId);<br><br>  if (loading) return &lt;Spinner /&gt;;<br>  if (error) return &lt;ErrorMessage /&gt;;<br><br>  return (<br>    &lt;div className=&quot;card&quot;&gt;<br>      &lt;h1&gt;{user.name}&lt;/h1&gt;<br>      {/* **Note: Formatting in the UI is fine for simple cases,** **but heavy formatting logic should be memoized or handled upstream.** */}<br>      &lt;p&gt;Member since: {new Date(user.joinedAt).toLocaleDateString()}&lt;/p&gt;<br>    &lt;/div&gt;<br>  );<br>}</pre><p>Now, if the API changes, you only fix the Hook. If the design changes, you only fix the UI. Clean, testable, and robust.</p><p>But a bloated component isn’t the only structural trap waiting for us.</p><h3>Trap 2: The telephone game</h3><p>Have you ever had to pass a prop through five different components just to get it to a button at the bottom of the tree?</p><p>This is called <strong>prop drilling</strong>, but I like to call it the Telephone Game.</p><p>In the game of Telephone, the message gets garbled the further it travels. In React, the data itself remains unchanged, but intermediate components still have to receive and pass down props they do not use. This creates unnecessary coupling and makes the component tree harder to maintain.</p><p>These intermediate components don’t need the data. They don’t use the data. They just pass it along. This creates a design bug called <strong>tight coupling</strong>. If you change the shape of the data at the top, you have to open and edit five unrelated files just to keep the chain intact.</p><p><strong>The fix:</strong> Use Component composition. Instead of passing data through a component, pass the child component itself as a prop (often children).</p><pre>// Prop Drilling: The Dashboard MUST accept and pass &#39;user&#39;<br>function Dashboard({ user }) {<br>  // Dashboard doesn&#39;t use user, but has to pass it to Header<br>  return &lt;Header user={user} /&gt;;<br>}<br><br>// Composition: Dashboard just renders children<br>function Dashboard({ children }) {<br>  // Dashboard doesn&#39;t care about &#39;user&#39; anymore!<br>  return &lt;Header&gt;{children}&lt;/Header&gt;;<br>}<br><br>// Usage: The data skips the middleman<br>&lt;Dashboard&gt;<br>  &lt;Avatar user={user} /&gt;<br>&lt;/Dashboard&gt;</pre><p>By nesting the components this way, the Dashboard never sees the user prop. It just renders whatever you put inside it.</p><p>If you need to share data across the entire app (like a theme or user auth), that is when you reach for the Context API, but use it sparingly to avoid performance bottlenecks.</p><h3>How to learn design thinking</h3><p>I didn’t wake up one day with a magical ability to see these architectural flaws. For a long time, I just copied and pasted solutions and hoped for the best.</p><p>Developing an eye for design takes study and practice.</p><p>If you want to understand the theory, the <a href="https://react.dev/">official React documentation</a> is actually incredible these days. It is free and very comprehensive. If you prefer watching deep explanations, video platforms like <a href="https://frontendmasters.com/">Frontend Masters</a> or <a href="https://www.udemy.com/topic/react/">Udemy</a> are excellent for getting a high-level overview of how experts structure their apps.</p><p>However, design is a muscle. You can’t learn it just by watching; you have to do it.</p><p>The thing that finally clicked for me was switching from passive watching to active coding. Interactive environments, like the React courses on <a href="https://www.educative.io/courses/learn-react?utm_campaign=persona_web_dev_q1_26&amp;utm_source=medium&amp;utm_medium=text&amp;utm_content=sofia_persona_feb&amp;utm_term=&amp;eid=5082902844932096">Educative</a> or similar platforms, gave me a sandbox to break things safely. I found that forcing myself to type out the patterns rather than just watching a video turned those abstract concepts into actual muscle memory.</p><h3>A quick design audit for your code</h3><p>But you don’t need a course to start thinking like an architect today. In fact, you can prevent 90 percent of these recurring issues just by pausing to check your structure before you type.</p><p>Before I write a single line of code, I take five minutes to do a Design Audit:</p><ol><li><strong>Draw the tree:</strong> Sketch your component hierarchy on paper or a whiteboard.</li><li><strong>Circle the state:</strong> Decide exactly where your data lives. It should only be as high up as it needs to be to serve its children.</li><li><strong>The prop test:</strong> Look at your sketch. If a component receives a prop but doesn’t use it for itself (it just passes it down), put a red star next to it. That is a candidate for refactoring.</li></ol><h3>Conclusion</h3><p>Architecture isn’t about over-engineering your code. It is about being kind to your future self.</p><p>The next time you are stuck on a bug that just won’t go away, take a step back. Don’t ask: <em>What is wrong with this line?</em></p><p>Ask: <em>What is wrong with this design?</em></p><p>It might just save you three days of frustration.</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=91a626bfa66e" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Stop storing derived state in React]]></title>
            <link>https://medium.com/@sofia_marques/stop-storing-derived-state-in-react-58d300258cb1?source=rss-f39bc61e24fb------2</link>
            <guid isPermaLink="false">https://medium.com/p/58d300258cb1</guid>
            <category><![CDATA[web-development]]></category>
            <category><![CDATA[react]]></category>
            <dc:creator><![CDATA[Sofia Marques]]></dc:creator>
            <pubDate>Tue, 24 Feb 2026 04:17:51 GMT</pubDate>
            <atom:updated>2026-02-24T04:17:51.550Z</atom:updated>
            <content:encoded><![CDATA[<p>I used to measure the complexity of my React components by how many state variables I managed. Early on, that felt like progress. More state meant more control.</p><p>One of the first places this showed up was a simple profile form. I had a first name field, a last name field, and a greeting banner that displayed the user’s full name as they typed. My instinct was to treat every visible value as its own piece of state. I stored the first name. I stored the last name. And I stored the full name too.</p><p>It felt like a natural first instinct. I even wrote a useEffect that listened for changes and kept everything in sync. I thought I was helping React by handing it the final value, already calculated and ready to render. At the time, this felt like a reasonable way to be explicit about what the UI needed, especially when I was still learning how React decides when to re-render.</p><p>That confidence did not last long.</p><p>What I did not realize at the time was that this pattern almost always pulls useEffect into the picture. As soon as you store a value that depends on other values, you need something to keep them in sync. For beginners, useEffect becomes the obvious place to put that logic, even when the problem is not an effect at all.</p><h3>The mental model that feels responsible</h3><p>Looking back, I can see the mental model I was using. State felt like a set of storage boxes. If something appeared in the UI, it must first live in a box. When one box changed, I was responsible for updating all the others that depended on it.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*2MqqpPNQPVtyknwYJ2AzEA.png" /></figure><p>This way of thinking is natural, especially if you come from a more imperative background. We think in steps. When X changes, do Y. When Y changes, do Z.</p><p>When you are new to React, this usually shows up as an effect. You already know how to say when something changes, do something, and useEffect feels like the official place React gives you to express that thinking.</p><p>React does not ask you to describe steps. It asks you to describe relationships.</p><h3>When synchronization starts to fail</h3><p>The problem with this storage-box model became obvious the moment I added a clear button. Resetting the form meant clearing the first and last name. I forgot to also clear the full name state in that handler.</p><p>For a brief moment, the inputs were empty, but the greeting banner still showed the old name.</p><p>Nothing was technically broken. The bug lived in the gap between updates. I had created multiple sources of truth, and I was now responsible for keeping them aligned across every possible path.</p><p>That was when it stopped feeling like a coding mistake and became a design issue.</p><h3>Defining derived state</h3><p>Derived state is any value that can be calculated from existing props or state. A full name built from the first and last name. A filtered list based on a search term. A total computed from a set of prices.</p><p>These values are not facts. They are answers to questions.</p><p>What helped most was changing how I thought about the state entirely. I stopped treating it like a database and started treating it like raw ingredients.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*9Pm31ahAH8rzfHIaOyuYaw.png" /></figure><p>In a kitchen, you store flour, sugar, and eggs. You do not store pre-mixed batter on the shelf. You mix it when you are ready to bake. In React, the render phase is the mixing bowl. If a value can be calculated there, it does not need to be stored.</p><p>The React documentation later reinforced this idea for me, especially <a href="https://react.dev/learn/you-might-not-need-an-effect">the guidance on cases</a> where effects are unnecessary, and state can be derived during render.</p><h3>The hidden cost of storing computed values</h3><p>Once you store a derived value, you also take on the responsibility of keeping it in sync. That responsibility often shows up as an effect whose only job is updating other state.</p><p>The code works. The UI mostly behaves. But the component now has extra moving parts. Extra renders. Extra dependencies. Extra places for bugs to hide.</p><p>I did not notice the cost right away. It appeared later, when small changes caused unexpected behavior and refactors felt riskier than they should have.</p><p>This shift also aligns with where React itself is headed. Newer React patterns encourage doing more work during render and reserving effects for true side effects. When derived values stay out of state, entire effects disappear, and the component becomes easier to reason about across renders.</p><h3>A common example with filtered lists</h3><p>Filtering a list based on user input is one of the places where this mistake shows up most often. It feels intuitive to treat the filtered result as its own piece of state. After all, it is what the UI renders, and it changes when the user types. Storing it can feel like a way to make that relationship explicit.</p><p>That was exactly how I approached it. I kept the search term in state, but I also stored the filtered list separately. Whenever the filter changed, I recalculated the list inside an effect and saved the result. At the time, this felt clean. The component knew what to show, and I was deliberately updating things.</p><p>Here is a pattern I used to write without hesitation.</p><pre>function ProductList({ products }) {<br>  const [filter, setFilter] = useState(&#39;&#39;);<br>  const [filteredProducts, setFilteredProducts] = useState(products);<br><br>  useEffect(() =&gt; {<br>    const result = products.filter(p =&gt;<br>      p.name.includes(filter)<br>    );<br>    setFilteredProducts(result);<br>  }, [filter, products]);<br><br>  return (<br>    &lt;div&gt;<br>      &lt;input<br>        value={filter}<br>        onChange={e =&gt; setFilter(e.target.value)}<br>      /&gt;<br>      &lt;ul&gt;<br>        {filteredProducts.map(p =&gt; (<br>          &lt;li key={p.id}&gt;{p.name}&lt;/li&gt;<br>        ))}<br>      &lt;/ul&gt;<br>    &lt;/div&gt;<br>  );<br>}</pre><p>This code is not wrong, but filteredProducts is fully determined by products and filter. It does not represent new information. It represents a calculation.</p><p>Removing that state removes the synchronization problem.</p><pre>function ProductList({ products }) {<br>  const [filter, setFilter] = useState(&#39;&#39;);<br><br>  const filteredProducts = products.filter(p =&gt;<br>    p.name.includes(filter)<br>  );<br><br>  return (<br>    &lt;div&gt;<br>      &lt;input<br>        value={filter}<br>        onChange={e =&gt; setFilter(e.target.value)}<br>      /&gt;<br>      &lt;ul&gt;<br>        {filteredProducts.map(p =&gt; (<br>          &lt;li key={p.id}&gt;{p.name}&lt;/li&gt;<br>        ))}<br>      &lt;/ul&gt;<br>    &lt;/div&gt;<br>  );<br>}</pre><p>If the calculation ever becomes expensive, it can be memoized. The principle stays the same. We are computing a value, not storing it.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*iZHx3jerfPanEZ-pvh9Tyg.png" /></figure><p>Developers like Kent C. Dodds have written extensively about <a href="https://kentcdodds.com/blog/application-state-management-with-react">keeping state minimal</a> and calculating values during render, which helped validate this shift for me.</p><h3>The question that changed how I use state</h3><p>Letting go of that extra state felt risky at first. I worried about performance and control. What I learned was that the render cycle is a safe place to do work, and React is very good at recalculating things when it needs to.</p><p>Now, before adding a state, I pause and ask whether this value represents something new, or whether it is simply answering a question I can already answer from existing data. That shift removed entire categories of bugs for me. Not because the code was shorter, but because there were fewer opportunities for it to be wrong.</p><p>Sometimes the simplest fix is not adding state, but deleting it.</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=58d300258cb1" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[React 19 changed how we should think about Async UI]]></title>
            <link>https://medium.com/@sofia_marques/react-19-changed-how-we-should-think-about-async-ui-002ea4c19e58?source=rss-f39bc61e24fb------2</link>
            <guid isPermaLink="false">https://medium.com/p/002ea4c19e58</guid>
            <category><![CDATA[web-development]]></category>
            <category><![CDATA[react]]></category>
            <dc:creator><![CDATA[Sofia Marques]]></dc:creator>
            <pubDate>Mon, 23 Feb 2026 05:49:16 GMT</pubDate>
            <atom:updated>2026-02-23T05:49:16.057Z</atom:updated>
            <content:encoded><![CDATA[<figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*EAJP2DOlvWBfJsZMMAOzFw.jpeg" /></figure><p>I used to think React versions were incremental. New APIs, same assumptions. <a href="https://www.educative.io/courses/learn-react?utm_campaign=persona_web_dev_q1_26&amp;utm_source=medium&amp;utm_medium=text&amp;utm_content=sofia_persona_feb&amp;utm_term=&amp;eid=5082902844932096">React 19</a> feels different. It changes how I think about async UI, beyond just the code.</p><p>The shift is subtle. It is also profound. React 19 asks us to separate concerns we have been blending for years, and to accept that a UI can be incomplete and still correct.</p><p>If that idea feels counterintuitive, that response is understandable. I had the same reaction.</p><h3>Async rendering is not the same as async data</h3><p>Older tutorials often blur these ideas together. Fetch data, wait, then render. Or show a spinner until everything is ready. That approach trained us to believe that async equals data fetching.</p><p>React 19 makes the distinction explicit.</p><ul><li>Async data is about when information arrives.</li><li>Async rendering is about when the UI is allowed to appear.</li></ul><p>They are related, but they are not the same thing.</p><p>With <a href="https://react.dev/reference/react/Suspense">Suspense</a> and the <a href="https://react.dev/reference/react/use">use() API</a>, React can begin rendering before data is fully available. Rendering can pause, resume, or restart without blocking the entire screen.</p><p>That means this mental model is outdated:</p><pre>// Old mental model<br>const data = await fetchData();<br>return &lt;UI data={data} /&gt;;</pre><p>React 19 encourages something closer to this:</p><pre>function Profile() {<br>  const user = use(fetchUser());<br>  return &lt;h1&gt;Hello, {user.name}&lt;/h1&gt;;<br>}<br><br>function App() {<br>  return (<br>    &lt;Suspense fallback={&lt;Loading /&gt;}&gt;<br>      &lt;Profile /&gt;<br>    &lt;/Suspense&gt;<br>  );<br>}</pre><p>In this example, fetchUser() returns a Promise. use() lets React pause rendering <em>Profile</em> until that Promise resolves. While it waits, the nearest &lt;Suspense&gt; shows the fallback UI instead of a blank screen.</p><p>The async work exists inside the render tree. React controls when the UI appears.</p><p>This pattern is what many developers now mean when they talk about a React async<strong> </strong>component in React 19. The component itself can suspend while data resolves, and React decides when it is safe to reveal it.</p><h3>UI completeness vs. correctness</h3><p>This is the part that really challenged my thinking during a sprint retro.</p><p>We have been taught to ship complete UIs. Every pixel is present. Every query resolved. No placeholders left behind.</p><p>React 19 argues that correctness matters more than completeness.</p><p>A UI is correct when it reflects the latest known state, does not lie to the user, and can safely update as new information arrives. At the same time, a UI can be correct even if incomplete.</p><p>A loading skeleton that matches the final layout is more correct than a spinner that blocks everything. A partially rendered page with accurate data is more correct than a blank screen waiting for perfection.</p><p>Suspense boundaries let us define what completeness means at different levels. Each boundary says: <em>If something inside me is not ready yet, show this fallback for just this section</em>.</p><pre>&lt;Suspense fallback={&lt;SidebarSkeleton /&gt;}&gt;<br>  &lt;Sidebar /&gt;<br>&lt;/Suspense&gt;<br><br>&lt;Suspense fallback={&lt;MainSkeleton /&gt;}&gt;<br>  &lt;MainContent /&gt;<br>&lt;/Suspense&gt;</pre><p>If the sidebar data is slow to load, you still render the main content. If the main content is slow, the sidebar can still appear. This avoids a single global “loading” state that blocks the entire page.</p><p>This is how good async UI feels. You get structure immediately, even if details are still loading.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*mYWedT1sumF0wGwiSk1Wfg.jpeg" /></figure><h3>Why older tutorials mislead us</h3><p>Most React tutorials were written when blocking fetches were the norm. They optimized for certainty.</p><ul><li>Fetch everything up front.</li><li>Block rendering until data resolves.</li><li>Avoid showing anything incomplete.</li></ul><p>These lessons were not wrong at the time. They are misleading now.</p><p>React 19 assumes that interruptions will happen. It expects renders to be paused. It treats async as a core constraint rather than an edge case.</p><p>Patterns like this now work against React:</p><pre>if (isLoading) {<br>  return &lt;Spinner /&gt;;<br>}<br><br>return &lt;Dashboard data={data} /&gt;;</pre><p>React 19 prefers gradients to binaries. By leaning on Suspense, <a href="https://react.dev/reference/react/startTransition">transitions</a>, and Actions, we let React decide what can safely appear and when.</p><h3>Actions and async intent</h3><p>One of my favorite surprises in React 19 is Actions. They treat async user intent as part of the render life cycle.</p><pre>function AddToCart({ productId }) {<br>  const [pending, action] = useActionState(addToCartAction, null);<br><br>  return (<br>    &lt;form action={action}&gt;<br>      &lt;button disabled={pending}&gt;<br>        {pending ? &quot;Adding…&quot; : &quot;Add to cart&quot;}<br>      &lt;/button&gt;<br>    &lt;/form&gt;<br>  );<br>}</pre><p>Here, <a href="https://react.dev/reference/react/useActionState">useActionState</a> ties an async server action directly to the UI. Submitting the form triggers addToCartAction, and React automatically tracks whether it is still running. While the action is pending, the button disables itself and updates its label, without manual loading state or effects.</p><p>The UI stays responsive. The intent is explicit. The async work does not leak into manual state juggling.</p><p>This is another example of correctness over completeness. The button reflects what is happening, even before the server responds.</p><h3>The new conceptual checklist</h3><p>Here’s a quick checklist I keep on hand now:</p><ol><li>Ask whether async is about data arrival or UI reveal.</li><li>Decide where incompleteness is acceptable.</li><li>Prefer boundaries over booleans.</li><li>Let React coordinate pauses and resumes.</li></ol><p>React 19 is not telling us to show less loading. It is telling us to show better loading.</p><h3>Final thought from a rookie</h3><p>As a React beginner, this shift is oddly comforting. I no longer have to force the UI to wait until everything is perfect. I can trust React to orchestrate the timing.</p><p>It feels less like writing instructions and more like staging a story. One scene flows into the next. The audience stays engaged. The cat stays asleep.</p><p>If React 18 taught us how to start thinking concurrently, React 19 teaches us how to think asynchronously with confidence.</p><p>That shift alone has changed how I approach every async interaction I build.</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=002ea4c19e58" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Why is useEffect overused?]]></title>
            <link>https://medium.com/@sofia_marques/why-is-useeffect-overused-34db5c3b2c9a?source=rss-f39bc61e24fb------2</link>
            <guid isPermaLink="false">https://medium.com/p/34db5c3b2c9a</guid>
            <category><![CDATA[react]]></category>
            <category><![CDATA[web-development]]></category>
            <dc:creator><![CDATA[Sofia Marques]]></dc:creator>
            <pubDate>Wed, 18 Feb 2026 05:53:14 GMT</pubDate>
            <atom:updated>2026-02-18T05:53:14.322Z</atom:updated>
            <content:encoded><![CDATA[<p>I am still early in my React journey, but after a few sprints, a few refactors, and more than a few, why is this running again? moments, I’ve noticed that even developers who know their stuff can fall into the trap of overusing useEffect. They are usually smart, well-intentioned, and trying to be responsible, but that is exactly why this <a href="https://www.educative.io/courses/learn-react/understanding-hooks-in-react?utm_campaign=persona_web_dev_q1_26&amp;utm_source=medium&amp;utm_medium=text&amp;utm_content=sofia_persona_blog_feb&amp;utm_term=&amp;eid=5082902844932096">hook</a> becomes so tempting.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*_spUIJ5nK1gZ76s5iKmkzQ.png" /></figure><p>I spent the better part of my last sprint staring at a single component that felt like a cascading waterfall of effects. I found the component confusing and hard to follow. I love React, but I think we need to talk about our reliance on the Effect hook.</p><h3>What useEffect is actually for</h3><p>At its core, useEffect exists to synchronize your component with something outside of React. That outside part matters more than most examples admit.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*V_zpaGjd9a15TIfc9GtWQg.png" /></figure><p>Effects cover things like browser APIs, timers, subscriptions, and manual data fetching. In other words, work that React itself cannot do during render. A simple mental model that helped me is this:</p><ul><li>Rendering answers the question: <em>What should the UI look like right now?</em></li><li>Effects answer: <em>What do I need to do because the UI just changed?</em></li></ul><p>Here is a valid, boring, and correct effect:</p><pre>import { useEffect, useState } from &quot;react&quot;;<br><br>function WindowWidth() {<br>  const [width, setWidth] = useState(window.innerWidth);<br><br>  useEffect(() =&gt; {<br>    function handleResize() {<br>      setWidth(window.innerWidth);<br>    }<br><br>    window.addEventListener(&quot;resize&quot;, handleResize);<br>    return () =&gt; window.removeEventListener(&quot;resize&quot;, handleResize);<br>  }, []);<br><br>  return &lt;p&gt;Window width: {width}px&lt;/p&gt;;<br>}</pre><p>This works because the browser resize event lives outside <a href="https://react.dev">React</a>. React cannot guess it for us, so we use the escape hatch.</p><h3>Why has it become a dumping ground?</h3><p>The problem starts when useEffect becomes the place where code that didn’t work elsewhere ends up. It is easy to see why we do it. We tend to think imperatively: ‘When the user changes the category, I need to update the list.’ That thought process leads us to write code that looks like this.</p><p>Here is a common example that looks reasonable at first glance:</p><pre>// The &quot;Smart&quot; Developer Trap<br>function PriceSummary({ items }) {<br>  const [total, setTotal] = useState(0);<br><br>  useEffect(() =&gt; {<br>    const sum = items.reduce((acc, item) =&gt; acc + item.price, 0);<br>    setTotal(sum);<br>  }, [items]);<br><br>  return &lt;p&gt;Total: ${total}&lt;/p&gt;;<br>}</pre><p>This feels right because it matches how we describe the task in English. But in React, this causes an extra render pass. The component renders with the old state, the Effect fires, the state updates, and the component renders again. While this might look harmless here, that extra render can impact performance, especially in larger apps or complex lists.</p><p>The solution is usually simpler. total is derived from items, so React can calculate it during render:</p><pre>// The Better Way<br>function PriceSummary({ items }) {<br>  // No state, no Effect, no extra render.<br>  const total = items.reduce((acc, item) =&gt; acc + item.price, 0);<br>  return &lt;p&gt;Total: ${total}&lt;/p&gt;;<br>}</pre><p>We treat useEffect as a dumping ground because we forget that rendering is just a function. If you have the inputs (props), you should calculate the output (JSX) right there.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*zRXS9hUdy5uq7DurPc05iQ.png" /></figure><h3>React 19’s reduced need for effects</h3><p>The React team seems to know that we are all struggling with this. React 19 is quietly reducing the pressure to reach for useEffect, not by removing it, but by making render smarter and more expressive.</p><p>React 19 is introducing features like the use API to handle async data. While this is a shift from how we write components today, it shows where the library is heading. Instead of manually coordinating fetches with effects, you can read data almost like a standard variable. This fundamentally shifts data requirements away from component life cycle events and treats them as resources that are simply consumed when needed.</p><p>A simplified example with use() looks like this:</p><pre>import { use } from &quot;react&quot;;<br><br>function UserProfile({ userPromise }) {<br>  const user = use(userPromise);<br>  return &lt;h2&gt;Hello, {user.name}&lt;/h2&gt;;<br>}</pre><p>There is no effect here, yet data fetching still happens. We are finally getting tools that handle the complex timing for us so we can focus on the data itself.</p><h3>A respectful reframing</h3><p>I do not think useEffect is overused because developers are careless. I think it is overused because it feels safe. It feels explicit. It feels like control.</p><p>But React’s model rewards trust. When you let render describe the UI and reserve effects for true side effects, components become easier to read and harder to break.</p><p>I still use useEffect. I just pause now and ask a quieter question first: <em>Is this syncing with something outside React, or am I just cleaning up a design decision?</em> Most of the time, the answer surprises me.</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=34db5c3b2c9a" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[State is not a variable (and never was)]]></title>
            <link>https://medium.com/@sofia_marques/state-is-not-a-variable-and-never-was-7966b177804a?source=rss-f39bc61e24fb------2</link>
            <guid isPermaLink="false">https://medium.com/p/7966b177804a</guid>
            <category><![CDATA[web-development]]></category>
            <category><![CDATA[react]]></category>
            <dc:creator><![CDATA[Sofia Marques]]></dc:creator>
            <pubDate>Tue, 17 Feb 2026 04:11:01 GMT</pubDate>
            <atom:updated>2026-02-17T04:11:01.053Z</atom:updated>
            <content:encoded><![CDATA[<p>If you are new to React, there is a 90 percent chance you have written this exact piece of code. I know I did.</p><p>I was building a simple form during my first month of learning React. I wanted to check if my state was updating correctly, so I did what any reasonable JavaScript developer would do. I logged the variable.</p><p>I expected to see the new number. Instead, I saw the old one.</p><p>I stared at my screen. I questioned my sanity. I questioned the browser. I genuinely wondered if React was broken. It wasn’t. My mental model was.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*uMZe3seM_XxZt4AJQ5H7ZQ.png" /></figure><p>That moment of confusion was my initiation. It was the moment I realized that the state is not a variable. It never was. And treating it like one is the fastest way to write buggy, unpredictable code.</p><p>What I didn’t realize at the time was that this wasn’t just a logging issue or a React quirk. It was an early sign that I was treating my component as a mutable script rather than a boundary with a clear responsibility. The bug was visible in syntax, but the cause lived in how I was thinking about state and ownership.</p><h3>The broken code and the hidden design problem</h3><p>Here is exactly what I wrote. It looks innocent enough.</p><pre>function Counter() {<br>  const [count, setCount] = useState(0);<br><br>  const handleClick = () =&gt; {<br>    setCount(count + 1);<br>    // I expected this to log the NEW value<br>    console.log(count); <br>  };<br><br>  return (<br>    &lt;button onClick={handleClick}&gt;<br>      Clicked {count} times<br>    &lt;/button&gt;<br>  );<br>}</pre><p><strong>The expectation:</strong> I click the button. count becomes 1. The console prints 1.</p><p><strong>The reality:</strong> I click the button. The screen shows 1. The console prints 0.</p><p>It felt like the code was gaslighting me. How could the screen display one thing and the console show another?</p><h3>Why does this happen (the snapshot)?</h3><p>This happens because of <strong>closures</strong>. When React renders your component, it takes a snapshot of all your variables at that specific moment in time.</p><p>In the code above, the handleClick function was created during the render, where count was 0. Even though you called setCount, that function is stuck in the past. It only knows about the version of the world where count equals 0.</p><p>Think of it like logging a variable inside a long-running function. You can update the data elsewhere, but unless that function runs again, it will continue to print the old value. React works the same way; your event handler doesn’t magically update itself just because the state changed.</p><p>When you use console.log(count), you are looking at the photo (the snapshot), not the person (the future render).</p><h3>The Batching bug</h3><p>It gets worse. Once I realized console.log wasn’t working, I tried to force the update by calling it multiple times. I thought that if I add 1 three times, it would surely go up by 3.</p><pre> const handleTripleClick = () =&gt; {<br>    // I want to add 3 to the count<br>    setCount(count + 1);<br>    setCount(count + 1);<br>    setCount(count + 1);<br>  };</pre><p>The result was surprising at first: the count increased by only one, not three, because in that snapshot the count was still zero. So I was basically telling React:</p><ol><li>Set count to 0 + 1</li><li>Set count to 0 + 1</li><li>Set count to 0 + 1</li></ol><p>React takes all these orders, looks at them, and says, Okay, so you want the final result to be 1.</p><p>It’s also worth noting that batching isn’t some accidental side effect; it’s an intentional design choice. React may batch updates differently depending on context, but the goal is always the same: make state updates predictable and efficient. That’s why React nudges you toward functional updates instead of relying on whatever value happens to be in scope.</p><p>At this point, it finally clicked for me: the console logs and batching behavior were just symptoms. The root cause was deeper. I was designing components as if they controlled state synchronously, rather than treating state as an external system the component reacts to. Once that assumption was wrong, unpredictability was inevitable.</p><h3>The fix: Updater functions</h3><p>To fix this, we need to stop relying on the current snapshot and instead give React an instruction for the future.</p><p>We use the <strong>updater function</strong>.</p><pre> const handleTripleClick = () =&gt; {<br>    // &quot;Take the PREVIOUS value, and add 1&quot;<br>    setCount(prevCount =&gt; prevCount + 1);<br>    setCount(prevCount =&gt; prevCount + 1);<br>    setCount(prevCount =&gt; prevCount + 1);<br>  };</pre><p>This works because we aren’t passing a hardcoded value (0 + 1). We are passing a function that says: Hey React, I don’t know what the number is right now, but whatever it is… add one to it.</p><p>This pattern matters even more once a component grows beyond a simple counter. Imagine a form component handling input values, validation state, and submission logic all at once. Treating the state like a variable in that setup quickly leads to race conditions, duplicated logic, and components that are hard to reason about or reuse.</p><p>What surprised me later was how much this changed the way I designed components. Once I stopped assuming I “owned” the current state value, I also stopped piling multiple responsibilities into the same component. Components became simpler, handlers became more predictable, and these bugs stopped appearing altogether.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*eo-QmDANkNBxQYqahoGtpw.png" /></figure><p>It is like handing the kitchen a note that says “add an egg to the burger” instead of handing them a finished burger and hoping they notice.</p><h3>Where this finally clicked for me</h3><p>This distinction didn’t really sink in for me through theory alone. I only understood it once I deliberately broke state updates and watched how React responded. If a component constantly surprises you, it’s usually not because React is being clever. It’s because that component is doing too much, holding onto assumptions it shouldn’t be making.</p><p>I didn’t arrive at this understanding by experimenting in VS Code alone. I had to revisit the underlying fundamentals.</p><p>I started with the <a href="https://react.dev/">React Beta Docs</a> because I needed to understand why state behaved differently from normal variables. The way they explain snapshots and renders helped me stop expecting immediate, synchronous updates. Long-form video courses on platforms like <a href="https://www.udemy.com/topic/react/">Udemy</a> reinforced this mental model by showing the same patterns repeated across components and examples.</p><p>What helped most, though, was practicing this exact failure mode. On <a href="https://www.educative.io/courses/learn-react?utm_campaign=persona_web_dev_q1_26&amp;utm_source=medium&amp;utm_medium=text&amp;utm_content=sofia_persona_blog_feb&amp;utm_term=&amp;eid=5082902844932096">Educative</a>, I worked through exercises where state updates intentionally behaved incorrectly unless I used functional updates. Seeing the same bug from this article break real code, and then fixing it, finally locked the concept in.</p><p>Because everything ran directly in the browser, I could intentionally misuse state, observe the results immediately, and fix the logic without worrying about setup. That tight feedback loop made the difference.</p><p>Looking back, the pattern was clear: theory helped me understand the rules, videos helped me recognize the patterns, and hands-on exercises forced me to confront my assumptions. Each resource played a different role in addressing the same underlying mistake.</p><h3>Quick checklist</h3><p>If you are currently debugging a state issue, run through this list.</p><ul><li>Don’t rely on console.log(state) immediately after setting it. It will always show the old value.</li><li>Do use the updater function setCount(c =&gt; c + 1) if your new state depends on the old one.</li><li>Remember, you are the customer; React is the kitchen. Be patient with your order.</li></ul><p>If your console output looks incorrect, don’t panic. It’s usually showing a cached or stale state rather than the current runtime data. Continue debugging with that in mind.</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=7966b177804a" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Why React feels harder than JavaScript at first]]></title>
            <link>https://medium.com/@sofia_marques/why-react-feels-harder-than-javascript-at-first-b728107631a0?source=rss-f39bc61e24fb------2</link>
            <guid isPermaLink="false">https://medium.com/p/b728107631a0</guid>
            <category><![CDATA[javascript]]></category>
            <category><![CDATA[react]]></category>
            <category><![CDATA[web-development]]></category>
            <dc:creator><![CDATA[Sofia Marques]]></dc:creator>
            <pubDate>Mon, 16 Feb 2026 07:10:15 GMT</pubDate>
            <atom:updated>2026-02-16T07:10:15.711Z</atom:updated>
            <content:encoded><![CDATA[<p>If React feels harder than JavaScript, even though you may have heard it described as <em>just JavaScript</em>, you are not bad at JavaScript. You are running into a different way of thinking about software.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*r-0mrfjI0LP-FfCOYD9t_Q.jpeg" /></figure><p>I remember one early component where I stored a piece of state in the wrong place, passed it through three layers of props, and then wondered why unrelated parts of the UI kept updating. I spent an embarrassing amount of time trying to “fix” the re-render before realizing the problem was not React. The problem was that I had not decided who actually owned that state.</p><p>That moment of confusion is familiar to almost everyone who comes to React from plain JavaScript, and it is the starting point for understanding why the library feels demanding at first.</p><p>This post is about why that feeling is normal, why it happens, and why it is actually a sign that React is doing its job.</p><h3>The mental shift: From imperative steps to declarative UI</h3><p>When you learn JavaScript first, most of what you write is imperative. You tell the browser exactly what to do, step by step.</p><pre>const button = document.querySelector(&quot;button&quot;);<br><br>button.addEventListener(&quot;click&quot;, () =&gt; {<br>  button.textContent = &quot;Clicked&quot;;<br>  button.disabled = true;<br>});</pre><p>This code reads like a checklist. On click, change the text. Then disable the button. You are in control of the sequence.</p><p>React asks a different question.</p><p>Instead of “what should happen next,” React wants to know “what should the UI look like given this state.”</p><p>In React, state is simply data that can change over time and cause the interface to update. Rather than manually updating the DOM, you update state and let <a href="https://www.educative.io/courses/learn-react/virtual-dom-the-power-of-react?utm_campaign=persona_web_dev_q1_26&amp;utm_source=medium&amp;utm_medium=text&amp;utm_content=sofia_persona_blog_feb&amp;utm_term=&amp;eid=5082902844932096">React reconcile the UI</a> for you.</p><pre>function Button() {<br>  const [clicked, setClicked] = React.useState(false);<br><br>  return (<br>    &lt;button<br>      onClick={() =&gt; setClicked(true)}<br>      disabled={clicked}<br>    &gt;<br>      {clicked ? &quot;Clicked&quot; : &quot;Click me&quot;}<br>    &lt;/button&gt;<br>  );<br>}</pre><p>Here, clicked represents whether the button has been pressed. It starts as false. When the user clicks the button, setClicked(true) updates that value. React then re-runs the component and recalculates how the button should look.</p><p>Notice what is missing. There is no instruction to change the text, nor a command to disable the button. Both behaviors fall under the same description. If clicked is true, the button is disabled and its label changes. If it is false, it is interactive and prompts the user to click.</p><p>That is the declarative shift. You are not telling the browser how to modify the interface. You are defining the relationship between state and output, and React enforces it consistently.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*7mO07UT_Ux0xhqAMM7ilDA.png" /></figure><p>If this mental shift still feels slippery, seeing the same idea explained from different angles can help. The <a href="https://www.educative.io/courses/learn-react?utm_campaign=persona_web_dev_q1_26&amp;utm_source=medium&amp;utm_medium=text&amp;utm_content=sofia_persona_blog_feb&amp;utm_term=&amp;eid=5082902844932096">Learn React</a> course walks through this model step by step, and the official<a href="https://react.dev/learn"> React documentation</a> is also unusually clear on how state and rendering fit together.</p><h3>React exposes design problems earlier</h3><p>Early on, React can feel like extra work. You write more code to do less. You add state, hooks, and components just to show a button. That friction is real. It exists because React front-loads design decisions that vanilla JavaScript lets you postpone.</p><p>In imperative code, you can patch behavior wherever you notice a problem. In React, you have to decide upfront where state lives, who owns it, and how it flows.</p><p>One reason React feels hard is that it refuses to let you hide architectural issues.</p><p>Here is a common beginner pattern.</p><pre>function Profile() {<br>  const [name, setName] = useState(&quot;&quot;);<br>  const [avatar, setAvatar] = useState(&quot;&quot;);<br>  const [theme, setTheme] = useState(&quot;light&quot;);<br>}</pre><p>Nothing is technically wrong at first. But as the component grows, the lack of clear ownership begins to create friction. Which state belongs together? What should be passed down? What should be shared?</p><p>In plain JavaScript, you might keep adding variables and event handlers until something breaks. In React, the discomfort shows up earlier, as cognitive load.</p><p>That early discomfort is feedback. React is telling you that your UI is asking for structure.</p><p>Dan Abramov’s article on<a href="https://react.dev/learn/thinking-in-react"> thinking in React</a> is a useful reference here, particularly for understanding how component boundaries and state ownership emerge from the UI itself.</p><h3>Common frustration points and why they exist</h3><h4>Why did this re-render?</h4><p>Re-renders are not errors. They are React doing its job.</p><p>If a component re-renders unexpectedly, it usually means one of two things:</p><ul><li>The state is changing in a way you did not expect.</li><li>You are relying on a value that is recreated on every render.</li></ul><p>React makes these issues visible so you can reason about them. One practical way to start is to log the state and props at the top of the component and watch which values change between renders. Seeing what actually changed is often enough to make the re-render stop feeling mysterious.</p><h4>Why is this so much boilerplate?</h4><p>Hooks, effects, and controlled components feel verbose because they encode constraints. Those constraints prevent entire classes of bugs related to stale data, race conditions, and inconsistent UI.</p><p>You are paying a small cost now to avoid high costs later.</p><h4>Why can’t I just change the DOM?</h4><p>You can, but React discourages it because direct DOM manipulation breaks the mental model. Once React loses confidence in the UI tree, bugs become unpredictable.</p><p>Think of React as a very strict stage manager. You can improvise, but only backstage.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*zFEVaIgafYAJ1qLlS455Jg.png" /></figure><h3>Is React hard to learn?</h3><p>React often feels hardest when design decisions can no longer be deferred. Questions about state, data flow, and responsibility stop being theoretical and start shaping the code you write.</p><p>That friction is not a sign that you are behind. It is a sign that the mental model is forming.</p><p>Once those boundaries become clearer, many of the earlier frustrations fade. Components become easier to reason about, changes become more predictable, and the codebase pushes back less often.</p><p>If React feels demanding right now, it usually means you are engaging with the parts that matter. With time and repetition, those demands turn into structure, and that structure becomes an advantage rather than an obstacle.</p><p>For readers looking to reinforce that mental model through guided practice, resources like Educative’s <a href="https://www.educative.io/courses/learn-react?utm_campaign=persona_web_dev_q1_26&amp;utm_source=medium&amp;utm_medium=text&amp;utm_content=sofia_persona_blog_feb&amp;utm_term=&amp;eid=5082902844932096">Learn React</a>, Kent C. Dodds’s writing on<a href="https://kentcdodds.com/blog/how-to-use-react-context-effectively"> component patterns</a>, and the React documentation’s<a href="https://react.dev/learn"> advanced guides</a> can all be effective, depending on how you prefer to learn.</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=b728107631a0" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[React isn’t hard (but your mental model might be)]]></title>
            <link>https://medium.com/@sofia_marques/react-isnt-hard-but-your-mental-model-might-be-68b284201866?source=rss-f39bc61e24fb------2</link>
            <guid isPermaLink="false">https://medium.com/p/68b284201866</guid>
            <category><![CDATA[react]]></category>
            <category><![CDATA[web-development]]></category>
            <dc:creator><![CDATA[Sofia Marques]]></dc:creator>
            <pubDate>Mon, 09 Feb 2026 05:41:14 GMT</pubDate>
            <atom:updated>2026-02-09T05:41:14.880Z</atom:updated>
            <content:encoded><![CDATA[<p>I recall the precise moment I almost quit using React.</p><p>I was building a simple “Shopping Cart” component. Nothing fancy. Just a list of items and a Total Price at the bottom. I had written the logic, set up the state, and clicked the “Add to Cart” button.</p><p>The number on the screen updated perfectly.</p><p>However, when I checked my console log to send that data to the backend, I found it was incorrect. It was showing the <em>previous</em> price, not the new one.</p><p>I stared at the code. I refreshed it. I clicked again. Same result.</p><p>“Why is React lying to me?” I thought. “I just told it to update the price! It’s right there on the screen!<em>”</em></p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*kB-z-xgh902H-V8wvbPkQg.png" /></figure><p>I spent four hours debugging that simple counter. I tried forcing updates. I tried moving variables around. I felt like I was fighting the library itself.</p><p>That’s when I realized something that changed my entire career. React wasn’t broken. My code wasn’t even technically “broken.”</p><p>My mental model was broken.</p><p>It’s like treating an automatic transmission like a manual; you can force it to work, but you’re fighting a system designed to handle the shifting for you. If you have ever felt like React is fighting you, you probably aren’t bad at coding. You might just be thinking about it the wrong way.</p><p>Here is how I shifted my perspective, and how you can too.</p><p>When I first started, I treated React like a collection of automatic triggers. I thought if I changed a variable, React would immediately “catch” it and update everything everywhere, right that second.</p><p>But that is not how it works.</p><p>Think of your React application like a restaurant kitchen.</p><p>In the old days of web development (like with jQuery or vanilla JavaScript), you were the chef <em>and</em> the waiter. You ran into the kitchen, grabbed a knife, chopped the onions, and carried the plate to the table yourself. You manually found the DOM element and changed it.</p><p>React is the <strong>head chef</strong>.</p><p>You (the component) are just the waiter. You don’t cook. You don’t touch the DOM. You just hand the chef an “Order Ticket” (your State and Props).</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*U8DZ8NCq6unKvbaXTH_j4Q.png" /></figure><p>You say, “Hey React, here is the new state. The total is now $50.”</p><p>React takes that ticket, checks the current state of the kitchen, and decides the most efficient way to update the view. It may wait a millisecond to batch orders together or briefly defer work to handle high-priority tasks.</p><p>When I tried to force the total to update instantly in my console log, I was yelling at the chef to cook faster. But the chef follows a process.</p><h3>The snapshot mindset</h3><p>This was the hardest part for me to grasp, but also the most important.</p><p><strong>Rendering is a snapshot in time.</strong></p><p>When your component runs, it is calculating the UI for <em>that specific moment</em>.</p><p>Let’s look at the code that confused me for hours:</p><pre>const [total, setTotal] = useState(0);<br><br>function handleAdd() {<br>  setTotal(total + 10);<br>  console.log(total); // This prints 0, not 10!<br>}</pre><p>In my head, setTotal should have changed the value immediately.</p><p>But in React’s mental model, the function handleAdd is running inside a “frame” of a movie where total is still 0. When you call setTotal, you are scheduling a <em>new</em> frame (a re-render) where the value will be 10.</p><p>You cannot see the future frame while you are standing in the current one.</p><p>If you absolutely need to run code <em>after</em> the state updates (like sending that data to a backend), you can’t do it in the same function. You typically need to use the useEffect Hook, which runs after the paint has dried on the new frame.</p><p>Once I understood that my variables were stuck in a “time capsule” for each render, the bugs stopped feeling random. They became predictable.</p><h3>The “waterfall” of data</h3><p>Another trap I fell into was trying to make sibling components talk to each other.</p><p>I had a Cart component and a Header component. I wanted the Header to show the number of items. My instinct was to try and “push” data from the Cart sideways into the Header.</p><p>I ended up with spaghetti code that was impossible to debug.</p><p>Then I learned the <em>Waterfall Rule</em>.</p><p>In React, data is like water. It only flows down. Gravity does the work.</p><p>If two components need to share data, you don’t build a pipe sideways. You go up to the source of the waterfall (the parent) and pour the water from there.</p><p>We call this “Lifting State Up,” but I prefer thinking of it as moving the water source. If the Header and Cart both need to know the total, the total doesn’t belong to the Cart. It belongs to the app, which feeds both of them.</p><h3>How to learn this (without pulling your hair out)</h3><p>You can read about mental models all day, but they don’t really stick until you experience them in code.</p><p>When I was stuck in a tutorial loop, watching videos but not retaining any information, I realized I needed to change how I studied. I needed to review the code, break it down, and fix it.</p><p>There are a lot of ways to do this, depending on how your brain works:</p><ul><li><strong>If you love documentation:</strong> The official React Docs (<a href="https://react.dev/learn/state-as-a-snapshot">react.dev</a>) are incredible. They use diagrams and interactive examples that make the “snapshot” concept really clear.</li><li><strong>If you are a visual learner:</strong> Platforms like <a href="https://scrimba.com/learn-react-c0e">Scrimba</a> or <a href="https://www.youtube.com/results?search_query=react+debugging+tutorial">YouTube</a> tutorials are great for seeing how a developer moves through files. Sometimes, just watching someone else debug can help you spot your own errors.</li><li><strong>If you learn by doing (like me):</strong> I found that video tutorials sometimes move too fast. I would miss a semicolon and spend 20 minutes rewinding. This is where text-based interactive courses are particularly helpful.</li></ul><p>This pain point is exactly why Educative’s <a href="https://www.educative.io/courses/learn-react?utm_campaign=persona_web_dev_q1_26&amp;utm_source=medium&amp;utm_medium=text&amp;utm_content=sofia_persona_feb&amp;eid=5082902844932096">Learn React 19: The Complete Guide to Modern Web Apps</a> resonated with me. It starts by building a mental model.</p><p>What makes it different is that you don’t have to set up your local environment just to try an idea. You read the concept (like State or Hooks), and there is a coding widget right there in the browser. You can test your understanding instantly.</p><p>For example, when you are learning about that “snapshot” issue I mentioned, you can run the code, see the console.log fail, fix it, and run it again immediately. It stops you from passively watching and forces you to actively think.</p><h3>The “Am I thinking in React?” checklist</h3><p>So, the next time you are stuck on a bug that makes no sense, stop coding. Don’t throw more useEffect hooks at the problem.</p><p>Ask yourself these four questions:</p><ol><li><strong>Am I trying to be the chef?</strong> Are you trying to manually change the DOM or force an update? Trust React to handle the “how.” You just handle the “what.”</li><li><strong>Where is the water coming from?</strong> If a component doesn’t have the necessary data, look it up. The parent should probably hold that state.</li><li><strong>Is this a snapshot?</strong> Remember that inside your function, your variables will not change until the <em>next</em> render.</li><li><strong>Am I mutating or replacing?</strong> React notices changes when you replace an object, not when you just edit a property inside it.</li></ol><h3>Be kind to your brain</h3><p>It took me months to shift from “jQuery mode” to “React mode.” It is not an IQ test. It shows a different underlying execution model.</p><p>The code that crashed my browser wasn’t a failure. It was a lesson that taught me how rendering works.</p><p>So, close those 50 browser tabs, take a breath, and draw your component tree on a piece of paper.</p><p>You’ve got this.</p><p>Happy rendering!</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=68b284201866" width="1" height="1" alt="">]]></content:encoded>
        </item>
    </channel>
</rss>