🔥 In my projects, I use a handful of “hidden gem” NPM packages. These club-ready bangers have really helped me out, but aren't super well-known. I thought it'd be fun to share some of them. 😄

Here are 5 of the secret weapons in my armory ⚔️

🧵
1. Windups, by @sgwil
npmjs.com/package/windups

A React package that provides components/hooks for creating "self-typing" bits of text, with all kinds of whimsical bells and whistles.

I use it in a couple places on my blog 😄
2. chroma-js by @driven_by_data
npmjs.com/package/chroma…

There are lots of packages for converting between color formats, but none are as comprehensive and well-thought-out as this one. Been using it in [REDACTED] and it's delightful.

Amazing interactive docs too!
3. artsy/fresnel, by Artsy
npmjs.com/package/@artsy…

This is a tool for responsive conditional rendering in React.

Unlike other packages like react-media, it's SSR-safe, so it works with Next/Remix/Gatsby. Super clever implementation, incredible DX + UX.
(I need to write a blog post that explains why artsy/fresnel is so good.

The short version: in other packages, every user (mobile AND desktop) will see the same initial thing for a brief instant, until the JS kicks in and the UI redraws. Fresnel fixes this problem.
4. Immer, by @mweststrate
npmjs.com/package/immer

We've all heard that immutability is good, but it can be *really* annoying to work with immutable objects/arrays.

Immer lets you use the often-much-simpler mutable operations, while secretly being immutable behind-the-scenes.
For example, let's say we want to take an array, and update one of the middle values. Check out the difference.

Both versions are immutable (`arr` is not changed).

It's pure magic, made possible by ES6 Proxies (though a fallback implementation is provided, making it IE-safe) Screenshot of code. Linked in next tweet
Raw code from screenshot: pastebin.com/y6eFx6tP
5. Radix Primitives
radix-ui.com/docs/primitive…

This is a *phenomenal* set of accessibility-focused UI primitives. All of the really-hard-to-get-right stuff like dialogs, accordions, menus, scroll containers. Bring your own styles.

The team is wonderful, too!
The GIF shows styled and lovely components, but the library is really focused on the functionality, making sure that everything works well across platforms and for all users.

It's also a collection of individual modular NPM packages. Pick the components you need in your project.
There are lots of accessibility-focused "primitives" component libraries, and I love it.

Here are some others I've used / heard good things about:

reach.tech
react-spectrum.adobe.com/react-aria/
headlessui.dev
These packages have helped me to be more productive, and made for a better developer + user experience. With the exception of artsy/fresnel (which I discovered recently), I've used all 5 packages in real-world projects. They're all 🔥🔥🔥🔥.

Hope they help you too!
(Also, I know not all of these are actually that obscure; Immer is apparently *super* popular if the NPM numbers are to be believed! But I haven't seen much discussion of these packages on Twitter. Hopefully they're new to you!)

• • •

Missing some Tweet in this thread? You can try to force a refresh
 

Keep Current with Josh W. Comeau

Josh W. Comeau Profile picture

Stay in touch and get notified when new unrolls are available from this author!

Read all threads

This Thread may be Removed Anytime!

PDF

Twitter may remove this content at anytime! Save it as PDF for later use!

Try unrolling a thread yourself!

how to unroll video
  1. Follow @ThreadReaderApp to mention us!

  2. From a Twitter thread mention us with a keyword "unroll"
@threadreaderapp unroll

Practice here first or read more on our help page!

More from @JoshWComeau

1 Jan
A couple years back, on Jan 1st, I shared a list of my favourite free design/dev mini-resources. I think it's time for an update!

Illustrations of people sit...Some groovy sloped lines. I...A set of sliders and controlsA color-picker
1. Open Peeps by @pablostanley — An endlessly-customizable, diverse, CC0-licensed, pay-what-you-want set of hand-drawn people illustrations.

I use these for the avatars on my course platform!

openpeeps.com A set of illustrations of p...
2. ColorReview by Anton Robsarve.

It's a color picker that integrates the WCAG color-contrast thresholds, so you can tell *as you're picking colors* whether they're accessible or not!

color.review
Read 23 tweets
13 Dec 21
I'm in the process of trying to rent some office space and my god, I've never seen an industry in such need of disruption 😅
Today's challenge is finding a company that will issue business liability insurance, a requirement for commercial leases. Unlike every other kind of insurance I've ever purchased, it can't be done online. You need to call and talk to people. LOTS of people.
I've learned that different insurance companies insure different kinds of businesses. The company I just spoke with, after being redirected 3 times, told me they can't do it because I sell products internationally, and they don't work with international businesses (??).
Read 8 tweets
11 Dec 21
PSA: Web browsers only understand pure, unadulterated CSS. All of the fancy tools we use — Bootstrap, Tailwind, Sass, CSS-in-JS libs — produce vanilla CSS for the browser.

If you want to be productive with these tools, you *need* to understand how CSS works.
I think a lot of developers think that these tools are shortcuts, as though you can learn them instead of learning CSS. But that's not actually true.

These tools are meant to *amplify* your CSS skills, not replace them!
Here's one big reason why: when things go awry, and you need to debug an interface that isn't right, the browser devtools will show you the CSS that has been applied. Not the Material UI components / Tailwind classes.

Even if you don't *write* CSS, you still need to *debug* CSS.
Read 5 tweets
28 Nov 21
I feel like there's a lot of hype about web3 on Twitter, and it might give folks the impression that they *need* to switch gears and start learning this stuff if they want to stay relevant.

I wanna push back on this a bit. I think you'll be just fine if you ignore the web3 hype.
I have no idea whether web3 will become the new standard. I would be surprised if it does, but I've been surprised before. 🤷‍♂️

But even if it does, it won't happen overnight, and the eventual technology will look very different from what people are learning today.
Let's imagine it's 1999, and you're bullish on this new "web 2.0" craze. You want to build a rich interactive web application. So you decide to learn the most bleeding-edge language of the era, Java.

Most "web 2.0" sites today are not built using Java.
Read 10 tweets
26 Nov 21
🎁 I have a little Black Friday gift for y'all! ✨

For the next couple days, you can check out the first few lessons from the Flexbox module in my CSS course, “CSS for JavaScript Developers”. 😄

Check it out here:
courses.joshwcomeau.com/css-for-js/04-…

(No signup required! Totally open.) Screenshot of the course pl...
I picked these lessons specifically because I think they have good standalone value. I bet you'll learn a thing or two from them!

(Also: these lessons have never been publicly available before! I did a similar “Open House” thing during the launch, but w/ different content.)
In Lesson I, “Hello Flexbox”, we talk about Flexbox's origins, why it's still relevant today, when to use Flexbox vs. Grid. We also look at a quick example, and see how the layout mode works.
Read 9 tweets
4 Oct 21
For most of the web, the text is the most important thing on the page.

🧵 Let's look at some of the stuff I've learned for keeping our text readable + accessible for everyone.
For folks with poor vision, larger text will help them be able to read.

There are two primary ways to increase font size:
1. Using the browser "zoom" controls (cmd/ctrl +, cmd/ctrl –)
2. Picking a larger default font size in the browser settings
Browser zoom works with most units, including px, em, and rem. It doesn't work with viewport units (vw/vh).

Scaling the default font size only works with em/rem/%.

So, while it's not as bad as it used to be, we still shouldn't use px for typography.
Read 13 tweets

Did Thread Reader help you today?

Support us! We are indie developers!


This site is made by just two indie developers on a laptop doing marketing, support and development! Read more about the story.

Become a Premium Member ($3/month or $30/year) and get exclusive features!

Become Premium

Too expensive? Make a small donation by buying us coffee ($5) or help with server cost ($10)

Donate via Paypal

Or Donate anonymously using crypto!

Ethereum

0xfe58350B80634f60Fa6Dc149a72b4DFbc17D341E copy

Bitcoin

3ATGMxNzCUFzxpMCHL5sWSt4DVtS8UqXpi copy

Thank you for your support!

Follow Us on Twitter!

:(