This site runs best with JavaScript enabled.

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): The form component here is called <UserSettings /> . This component exposes…

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 →

How to use React Context effectively

In Application State Management with React , I talk about how using a mix of local state and React Context can help you manage state well in any React application. I showed some examples and I want to call out a few things about those examples and how you can create React context consumers…

Read →

Application State Management with React

Managing state is arguably the hardest part of any application. It's why there are so many state management libraries available and more coming around every day (and even some built on top of others... There are hundreds of "easier redux" abstractions on npm). Despite the fact that state management…

Read →

How to know what to test

Knowing how to test is great and important. I've created a LOT of content that teaches people the fundamentals of testing, how to configure tools, how to write tests for specific scenarios, and so on. But knowing how to write tests is only half the battle to achieve confidence in your application…

Read →

AHA Testing 💡

The AHA Programming Principle stands for "Avoid Hasty Abstraction." I have specific feelings about how this applies to writing maintainable tests. Most of the tests that I've seen in the wild have been wildly on one side of the spectrum of abstraction: ANA (Absolutely No Abstraction), or…

Read →