Skip to main content

r/reactjs


I built a free deep-dive tutorial on React Internals (Fiber, Hydration, Event Loop, etc.) for everyone who wants to know how things actually work under the hood.
I built a free deep-dive tutorial on React Internals (Fiber, Hydration, Event Loop, etc.) for everyone who wants to know how things actually work under the hood.
Resource

Hey everyone,

If you’re a frontend engineer who has been using React for a while, you’ve probably had moments where you know how to use a feature, but you still have a lingering gap in understanding why it works.

I kept running into these same burning questions:

  1. "React pauses and resumes work." - Wait, what does that actually mean? What are the exact mechanisms behind this?

  2. useState & useEffect - We all know the do's and don'ts, but sometimes it feels hard to truly internalize how they operate behind the scenes.

  3. The Fiber Tree - I've seen the conference talks, but what actually is it? How is it built, and how does it drive React?

  4. useLayoutEffect - How, when, and why exactly?

  5. The Event Loop -Tying React's execution (macro vs. micro tasks) back to Jake Archibald's famous event loop talk from years ago.

  6. Suspense - It's great for loading states, but how does React know exactly when the data is ready to swap out the loaders?

  7. Optimization - useMemo, useCallback, and React.memo cache things, but what’s the actual engine behind them?

  8. Hydration - The classic "breathing life into HTML" metaphor - but what is the actual code doing to make this magic happen?

  9. The Rendering Pipeline - How exactly does React hook into the browser's rendering steps?

  10. Custom Hooks - We write them daily and get asked about them in interviews, but what happens under the hood? How does React actually wire them up to our components?

There are plenty of other concepts, but if these questions ever keep you up at night, I have some good news. I finally sat down and put together a comprehensive tutorial that answers all of them and demystifies the "black box" of React.

Link: https://arpitjsoni.com/react-internals

Price: It’s 100% free. If you find it genuinely helpful, taking a second to like or retweet my pinned post on Twitter would mean the world to me, but otherwise, just enjoy the read!

P.S: I’m not super active on Reddit, so I likely won't be checking my DMs here, but I hope this helps some of you out!


Advertisement: Could DUPIXENT help?
Could DUPIXENT help?

Click here to see Full Prescribing Information and Patient Information.

media poster



Does Zustand Preserve the Relationship Between a Selected Value and Its Source Object?
Does Zustand Preserve the Relationship Between a Selected Value and Its Source Object?

I’m using Zustand and I have a Map<string, Persona>:

const persone = new Map([
  ["id1", { nome: "Mario", cognome: "Rossi", eta: 40 }],
  ["id2", { nome: "Dario", cognome: "Roi", eta: 34 }],
  ["id3", { nome: "Mari", cognome: "Ossi", eta: 32 }],
]);

If I change the nome of id2 from "Dario" to "Luigi" and I have a subscription to the name, my question is:

Can the subscription know directly that id2 changed and therefore have access to the modified object, or does it only receive the new value "Luigi" and have to search the Map/array to find the person?

In other words: Does Zustand preserve the relationship between the selected value (nome) and the object it comes from, or is that information lost by the selector?