Simple is better than clever in open-source (by 250x)
TL;DR; Today I saw my simple library use-local-storage-state
has reached 2 million total downloads while my other clever* library main-thread-scheduling
has only 8k. In this case simple won over clever by 250x. I explore why because: 1) it's curious, 2) I want to maximize my value in the open-source community by not making the same mistake twice.
use-local-storage-state
is simple and popular
use-local-storage-state
is a 3kb React hook for handling data in localStorage
. It has a lot of competition but it's currently the most downloaded one. The usage is simple:
const [state, setState] = useLocalStorageState('localStorageKeyHere')
main-thread-scheduling
is clever* and unused
main-thread-scheduling
is a 3kb library that can make your app responsive and fast in just a single line of code. Nota uses it for its super fast search and Flux.ai uses it for their advanced 3D circuits editor. Usage:
import { yieldOrContinue } from 'main-thread-scheduling'
async function expensiveComputation() {
// slow and complicated code here
await yieldOrContinue('user-visible')
}
Why?
Even from the description, you can still observe my bias towards main-thread-scheduling
, its awesomeness, and superiority 😄. However, the marker never lies — use-local-storage-state
is 250 times more popular. I've spent quite a bit of time contemplating this. I think these are the main reasons why this is happening:
use-local-storage-state
is searchable. People who need this library know exactly what they are searching for and what keywords to use. On the other side, you have to think a lot to understand that a library likemain-thread-scheduling
might be what you need and I have no idea what keywords people use to search it (I even have "Web Worker" as a keyword because you might think that's the solution you are looking for).main-thread-scheduling
is too complex. Before I promoted it, I asked a bunch of friends to give me feedback. The most common message I got (either directly or indirectly) was that they didn't understand what the library was doing. (I improved the docs a lot afterward but that doesn't seem to help.)use-local-storage-state
is useful in more projects. A lot of projects need to store some data inlocalStorage
but just a handful of projects are doing extremely heavy computations that require scheduling on the main thread.
Conclusion
These realizations are a pain for me. I want to work on difficult problems that have simple and elegant solutions but I'm now a little discouraged. I'm not sure what I should do.
* It's not clever if people don't use it.