This site runs best with JavaScript enabled.
Looking for something specific? Search for a blogpost here.

One simple trick to optimize React re-renders

I was preparing a blog post on a subject related to React re-renders when I stumbled upon this little React gem of knowledge I think you'll really appreciate: https://twitter.com/kentcdodds/status/1143200604065431552 Let's break that down with a simple contrived example and then talk about what…

Read →

Colocation

We all want to have codebases that are easy to maintain, so we start out with the best of intentions to make our codebase (or our corner of the codebase) maintainable and easy to understand. Over time, as a codebase grows, it can become more and more difficult to manage dependencies (JS, CSS, images…

Read →

When to useMemo and useCallback

Current Available Translations: Korean Here's a candy dispenser: Here's how it's implemented: Now I want to ask you a question and I want you to think hard about it before moving forward. I'm going to make a change to this and I want you to tell me which will have the better performance…

Read →

What open source project should I contribute to?

This is a question I've had countless times: https://twitter.com/sarna_pranu/status/672438850724175872 Pranu first pull request soon after tweeting this https://twitter.com/geraldchecka/status/670445392706736128 And in direct messages, emails, etc. The general gist of it is: "What open source…

Read →

Avoid the Test User

The two users your UI code has are 1) The end user that's interacting with your component and 2) the developer rendering your component. Imagine you have the following UI (taken from my Advanced React Patterns material): Note: this is not a screenshot. You can actually interact with that form…

Read →

Authentication in React Applications

Skipping to the end Here's the secret to this blog post in one short code example: That's it. Most apps which require authentication of any kind can be drastically simplified by that one little trick. Rather than trying to do something fancy to redirect the user when they happen to land on a page…

Read →

How to optimize your context value

NOTE: I want to add that the times it's important to optimize your context value is when a certain combination of the following conditions are met: Your context value changes frequently Your context has many consumers You are bothering to use React.memo (because things are legit slow) You've…

Read →