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

Speed up your App with Web Workers

Watch "Get started with Web Workers" on egghead.io https://egghead.io/lessons/javascript-get-started-with-web-workers?pl=kent-s-blog-posts-as-screencasts-eefa540c&af=5236ad I remember when I started learning about threads in Java. My college professor pulled up iTunes, hit play on a song and said…

Read →

Don't Sync State. Derive It!

In my Learn React Hooks workshop material, we have an exercise where we build a tic-tac-toe game using React's useState hook (based on the official React tutorial). Here's the finished version of that exercise: https://codesandbox.io/s/github/kentcdodds/learn-react-hooks/tree/master/?fontsize=1…

Read →

State Colocation will make your React app faster

Current Available Translations: Korean One of the leading causes to slow React applications is global state, especially the rapidly changing variety. Allow me to illustrate my point with a super contrived example, then I'll give you a slightly more realistic example so you can determine how it can…

Read →

Profile a React App for Performance

The React DevTools is an amazing piece of software and is available as a browser extension for Chrome , Firefox , and is capable of being wired up to work with React app's anywhere. One of the coolest features of the React DevTools is its profiling capabilities. There's a lot to the profiler, and…

Read →

Fix the slow render before you fix the re-render

Performance is a serious issue and we should make our apps as fast as possible. How we go about doing that will make a big impact on not only the effectiveness of our optimizations but also the complexity of our code (how quickly we can make improvements and changes in the future). When we're…

Read →

How to implement useState with useReducer

Watch "Implement useState with useReducer" on egghead.io https://egghead.io/lessons/react-implement-usestate-with-usereducer?pl=kent-s-blog-posts-as-screencasts-eefa540c&af=5236ad Here's the TL;DR: Wanna dive in? Let's go. But Kent... Why? For fun 🤓 Also I think that re-implementing things is a…

Read →

Write fewer, longer tests

Imagine we have this UI that renders a loading spinner until some data is loaded: Here's what that would render (I added a "Re-mount" button so you can try making it re-load. I also made it fail 50% of the time): Let's talk about testing this component. I'm going to mock out the api.getCourseInfo…

Read →