Essential reading to become a better React developer  ͏  ͏  ͏  ͏  ͏  ͏  ͏  ͏  ͏  ͏  ͏  ͏  ͏  ͏  ͏  ͏  ͏  ͏  ͏  ͏  ͏  ͏  ͏  ͏  ͏  ͏  ͏  ͏  ͏  ͏  ͏  ͏  ͏  ͏  ͏  ͏  ͏  ͏  ͏  ͏  ͏  ͏  ͏  ͏  ͏  ͏  ͏  ͏  ͏  ͏  ͏  ͏  ͏  ͏  ͏  ͏  ͏  ͏  ͏  ͏  ͏  ͏  ͏  ͏  ͏  ͏  ͏  ͏  ͏  ͏  ͏  ͏  ͏  ͏  ͏  ͏  ͏  ͏  ͏  ͏  ͏  ͏  ͏  ͏  ͏  ͏  ͏  ͏  ͏  ͏  ͏  ͏  ͏  ͏  ͏  ͏  ͏  ͏  ͏  ͏  ͏  ͏  ͏  ͏  ͏  ͏  ͏  ͏  ͏  ͏  ͏  ͏  ͏  ͏  ͏  ͏  ͏  ͏  ͏  ͏  ͏  ͏  ͏  ͏  ͏  ͏  ͏  ͏  ͏  ͏  ͏  ͏  ͏  ͏  ͏  ͏  ͏  ͏  ͏  ͏  ͏  ͏  ͏  ͏  ͏  ͏  ͏  ͏  ͏  ͏
href.email

This is issue 011 of href.email, your dose of interesting links about tech, dev and design.

React has been our frontend team's weapon of choice for over 5 years now. Occasionally we need to onboard someone new to the framework. This week we're sharing a list we'd share with them: articles that align with our values and principles building a React app. This list is geared towards developers with at least some React or frontend framework experience. It's not a getting started from scratch guide, but a collection of deeper principles and advanced patterns that affect how we write and structure components.

Not a React dev? You still might want to skim through these—a lot of the advice applies to any component based framework.

First some guiding principles:


With React, we try to avoid React as much possible to avoid ending up with component spaghetti:

  • Avoid state: we reach for controlled components by default, but considering uncontrolled components might reduce the amount of state you have to manage. And less state === less bugs.
  • Avoid effects: useEffect can introduce a lot of accidental complexity and hard-to-track bugs. Know when you might not need an effect and use the infamous hook as sparingly as possible.
  • Avoid memoization: consider other patterns before you memo().

Patterns to keep in mind when building your application's component library:


Finally, some library recommendations:

Radix Primitives is our go-to component library for dropdowns, modals… clsx is a small but mighty utility to conditionally apply CSS classes. react-hook-form is our favorite form library. When our state management needs go beyond useState we install Jotai. TanStack Query is great to fetch and cache data from an API. In the rare cases we need a standalone client-side router, we'll use TanStack Router.

The sponsor of this issue

This issue of href.email is sponsored by Mailcoach, a flexible, privacy-friendly email platform for writers, creators, and more. Pay for what you send, not your subscriber count. Use coupon HREF for 3 months free.

Interesting links
  • Quick tip from Wes Bos: stop using position: absolute to stack items on top of each other, use display: grid instead.
  • Working with time intervals? Always use a [closed, open) interval. Those brackets aren't a typo, Fernando Hurtado Cardenas has a thorough explanation.
  • There's a new RFC to introduce a pipe operator in PHP 8.5. Other iterations have been rejected twice, hopefully the third time is the charm!
  • Consider writing subject-first commit messages for a more scannable git history.
  • Jason Fried argues productivity should be measured with subjectivity. Humans are emotional, irrational beings. Reducing our actions to numbers gives a false sense of precision.

We build our computers the way we build our cities—over time, without a plan, on top of ruins.

— Ellen Ullman

That’s it for this week! Thank you for reading href.email. If you enjoyed this issue, feel free to share it with your friends.

Brought to you by Spatie

Unsubscribe