Georg Unterholzner @georg.dev · Mar 5

The first thing that comes to mind is adding a callback to the wrapper, allowing the user to retrieve the state. However, this feels a bit boilerplate-y. Every user would now have to manually wire the two components together. I’m not a fan of that.

0 likes 1 replies

?

Replies

Georg Unterholzner · Mar 5

Using a React context, maybe? It feels very idiomatic to React to do it that way, and it leads to a very smooth API. However, I don’t like that now my library suddenly also has to export a context instead of just the component.