Strangers on the internet who inspired my open-source library
Tags: redux, opensource, javascript, react
Published: 2019-11-28 11:49:10

---
title: "Strangers on the internet who inspired my open-source library"
description: "I wrote a blog about strangers on the internet who inspired me to write an open-source library."
published: true
---

<b>Should I read this post?</b>

I think that you are more likely to find value in reading this post if you are:
  1. Interested in my experience of learning from others; or
  2. Curious about the history of [Redux-Leaves](https://redux-leaves.js.org); or
  3. Made happy by expressions of gratitude to strangers on the internet.

<hr/>

A habit that I picked up during my academic studies is giving due credit to individuals who have been influential in shaping my thoughts, so I thought that it would be.

This occurred to me as I was preparing to give a couple of talks about an open-source library that I've written, [Redux-Leaves](https://redux-leaves.js.org).

Right now, I don't actually want to talk about myself or Redux-Leaves, but about how *strangers on the internet who I have never met in real life* made Redux-Leaves possible - not by contributing code to the repository, but by contributing ideas, blogs and talks to the public domain.

I think the time pressure in a talk would make it difficult for me to acknowledge those who have influenced my thought in a sufficiently eloquent or detailed way, and so I've decided to write up those thoughts in a blog post instead (and follow their example of putting things in the public domain!).

In no particular order, these individuals are are:
- [Dan Abramov](#dan-abramov-dan_abramov)
- [Mark Erikson](#mark-erikson-acemarke)
- [Shawn Wang](#shawn-wang-swyx)
- [Kent C. Dodds](#kent-c-dodds-kentcdodds)
- [Tyler McGinnis](#tyler-mcginnis-tylermcginnis)

In some of these cases, I might be giving credit to an individual when it might actually be more appropriate to give it to a group of which said individual happens to be most prominent. This is not intentional and I apologise for people whom I have overlooked.

In writing this up, I've also realised that I'm missing out on a lot of learning by doing a <small>VERY BAD JOB</small> at finding diverse voices to learn from. So, selfishly, I'd love it if you would [tweet me](https://twitter.com/richardcrng) recommendations on individuals, newsletters or blogs to follow, particularly those more likely to have diverse viewpoints.

Without further ado, here's how each of those individuals contributed in some way to me writing [Redux-Leaves](https://redux-leaves.js.org).

## Dan Abramov ([@dan_abramov](https://twitter.com/dan_abramov))

I'd like to credit Dan with three things:

1. For [planting the seed of my 'a-ha!' moment](#planing-the-seed-of-my-a-ha-moment);
2. For [creating Redux](#creating-redux); and
3. For [giving great talks](#giving-great-talks) generally.

### Planting the seed of my 'a-ha!' moment

What I say below will make a lot more sense if you watch at least the one minute of footage where Dan [introduces the React useState hook](https://youtu.be/dpw9EHDh2bM?t=1291), although I recommend watching more of the talk (because it's great!).

The way that Dan introduced `name` and `setName` as a pair made me realise that a Redux store's `reducer`, and the `actions` dispatched to it, could be a pair returned from a single function. A reducer needs to be closely related to the actions dispatched to it.

This influence is clear when you compare the signatures for `useState` and `reduxLeaves`:
```js
const [state, setState] = useState(initialValue)
const [reducer, actions] = reduxLeaves(initialState)
```

That 'a-ha!' moment for an API which gave you both `reducer` and `actions` - I didn't have any implementation specifics, just the high-level API desire - eventually led to the development of [Redux-Leaves](https://redux-leaves.js.org), which I'll write about in more technical detail another time.

### Creating Redux

Another great talk given by Dan was the one where he [introduced Redux](https://youtu.be/xsSnOQynTHs?t=664) (reducers + flux). Clearly, as a library which came out of my experiences with Redux, Redux-Leaves is also existentially indebted to Redux, although that might be obvious and non-interesting.

It might be worth noting that Redux-Leaves uses a cursor-ish approach, which [Dan might not have intended for Redux](https://github.com/reduxjs/redux/issues/155#issuecomment-113898044), so he might regard me as doing something completely barbaric with Redux-Leaves. I won't put words in his mouth here, though, as I think [Dan's opinions on Redux may have changed since he created it](https://twitter.com/dan_abramov/status/1191487232038883332?lang=en).

### Giving great talks

If it wasn't obvious from the fact that I've linked to two of his talks, I think Dan does really great talks. I think that they have a nice theatricality that brings in the audience, and it also looks like he just really enjoys giving them, which itself makes them enjoyable to watch.

I think it's partly Dan's talks that have inspired me to start giving my own talks - which is why it's also great that Dan has [written about how he prepares for his talks](https://overreacted.io/preparing-for-tech-talk-part-3-content/).


<br />

## Mark Erikson ([@acemarke](https://twitter.com/acemarke))

I'd like to credit Mark with three things:

1. An inspiring [dedication to documentation](#dedication-to-documentation);
2. Remarkably thorough [writings on and around Redux](#writings-on-and-around-redux); and
3. [Maintaining Redux](#maintaining-redux) entirely outside his day job.

### Dedication to documentation

Mark is *seriously* [committed to good documentation](https://github.com/reduxjs/redux/issues/3615). It's something that has inspired me with Redux-Leaves - I'm aiming to hit the same high bar of documentation. (I've even followed Mark in using [Docusaurus](https://docusaurus.io/).)

### Writings on and around Redux

Mark has pulled together some really amazing writings on Redux - the two most significant being:

1. [Idiomatic Redux: The Tao of Redux, Part 1 - Implementation and Intent](https://blog.isquaredsoftware.com/2017/05/idiomatic-redux-tao-of-redux-part-1/); and
2. [https://blog.isquaredsoftware.com/2017/05/idiomatic-redux-tao-of-redux-part-2/](https://blog.isquaredsoftware.com/2017/05/idiomatic-redux-tao-of-redux-part-2/).

It's certainly not *necessary* to read these before using Redux or Redux-Leaves, but I think if you're serious about deeply understanding Redux, it's highly advisable to read them.<sup><a name='fn-1' href='#en-1'>1</a></sup> I can't strongly enough recommend Mark's posts for how well-written, researched and thought provoking they are.

### Maintaining Redux

Mark also does a really heroic job of maintaining Redux - it's not his day job, he does it in his free time. I for one absolutely *love* the React-Redux hooks, released in v7.1.0, and rejoice in the prospect of never having to write another `connect`. Although the hooks seemed to appear like magic into my code with the update, an incredible amount  of [discussion](https://github.com/reduxjs/react-redux/issues/1179) and [work](https://github.com/reduxjs/react-redux/issues/1252) went into them.

A big milestone recently was the official release of [Redux Toolkit](https://redux-toolkit.js.org/), which deserves to be looked at by all Redux developers. In particular, I'm a fan of its [`configureStore`](https://redux-toolkit.js.org/api/configureStore) export as a big improvement on the API of [`createStore`](https://redux.js.org/api/createstore) from the core Redux library.

Predictably, I personally prefer [Redux-Leaves](https://redux-leaves.js.org) to [`createSlice`](https://redux-toolkit.js.org/api/createSlice), but I'd urge everybody to try out Redux Toolkit and see how they find it.

<br />

## Kent C. Dodds ([@kentcdodds](https://twitter.com/kentcdodds))

Kent's writings on testing have made it significantly easier for me to refactor and publish updates to Redux-Leaves.

In particular, Kent brought two particular ideas to my attention: 

> [Write tests. Not too many. Mostly integration.](https://kentcdodds.com/blog/write-tests)

<br />

> [The more your tests resemble the way your software is used, the more confidence they can give you.](https://twitter.com/kentcdodds/status/977018512689455106)

What does this mean in practice?

[Redux-Leaves](https://redux-leaves.js.org) as a library has very few unit tests, and quite a lot of integration tests, most of which are tests of documentation examples - i.e., tests that resemble the way the library is likely to be used.

The library has been through two refactors of note since I first wrote it. In the first refactor, I ended up dumping a lot of unit tests that were [testing implementation](https://kentcdodds.com/blog/testing-implementation-details) and therefore completely wrecked by the refactor. I felt no qualms about this - the intended, documented use was covered by the integration tests, that were still passing after the refactor. In the second refactor, I don't remember having to rewrite or delete many tests at all, since the remaining tests were pretty much all about usage and not about implementation.

I now try to follow a process of 'Documentation-Driven Development' with Redux-Leaves. I start by writing the documentation for a new feature, and then I write tests for the documented usage that are agnostic about implementation, and *then* I start writing code. It's a marrying together of what Kent writes about testing with my [dedication to documentation](#dedication-to-documentation) as inspired by Mark Erikson.


## Shawn Wang ([@swyx](https://twitter.com/swyx))

Shawn is famous for writing about [learning in public](https://www.swyx.io/writing/learn-in-public).

I'm still trying to improve on this - for example, I sometimes worry about bothering people or looking like a shameless self-promoter, and Redux-Leaves has *mostly* been hacked together by myself, for myself - but I have nonetheless managed to gain *some* benefits from it. In the very early days of the library, I managed to get some really valuable feedback (with one particular signpost to [Proxies](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Proxy) leading to a major rewrite of the library).

This blog post itself is an example of me trying to be better at learning in public!

## Tyler McGinnis ([@tylermcginnis](https://twitter.com/tylermcginnis))

I subscribe to Tyler's [weekly Javascript newsletter](https://tylermcginnis.com/newsletter/), which I like because it keeps a pipeline of cool projects coming into my inbox. I look at them, and I feel inspired to keep working on my own projects, the most major of which is - of course - [Redux-Leaves](https://redux-leaves.js.org)!

<hr />

What do I hope are the key takeaways from this?

Well, I'd like to think that this post helps encourage somebody to keep learning and working on their project, whether that be an open-source library like [Redux-Leaves](https://redux-leaves.js.org) or something else.

The individuals I've cited all have pretty high-profiles, in that they all have at least 10k Twitter followers, so they *certainly* don't need me to promote them - but, even so, I think it's nice to thank people who've helped you, so I also would like to think that I've achieved that.

Finally, because I like the [rule of three](https://en.wikipedia.org/wiki/Rule_of_three_(writing)), I'll circle back to something I've alluded to earlier: I'm aware of an extreme lack of diversity in the figures I've cited here, which means that I'm missing out on a lot of learning. I want to fix this shortcoming. If you can think of anybody that I should follow, please [tweet me](https://twitter.com/richardcrng) a suggestion!

<hr />

#### Endnotes

<sup><a name='en-1' href='#fn-1'>1</a></sup> One thing that comes out of Mark's posts is that there are many *technically valid* ways to write Redux code, but not all of these might be intended ways to write it. For example, [Redux-Leaves](https://redux-leaves.js.org) is a [cursor-ish library](https://blog.isquaredsoftware.com/2017/05/idiomatic-redux-tao-of-redux-part-2/#reducer-variations) that [is more suited to modelling setters than events](https://blog.isquaredsoftware.com/2017/05/idiomatic-redux-tao-of-redux-part-2/#action-tense-and-setters-vs-events), which is technically valid - but this is not necessarily the way that Redux is intended to be used.

I had a short conversation with Mark about this, where he said: (a) "it's a legitimate approach from a technical standpoint, but not how we're trying to encourage people to think about things"; and (b) "if you've found a variation on a usage pattern that works well for you, go ahead and do that".

So, [*caveat emptor*](https://en.wikipedia.org/wiki/Caveat_emptor) with [Redux-Leaves](https://redux-leaves.js.org), but  I will write a separate covering my thoughts in more detail at some point. Acknowledging that Redux-Leaves might not be following an intended usage pattern for Redux, I still find that the benefits for me when I use it greatly outweigh the costs. <small>[MAIN](#fn-1)</small>