Georg Unterholzner @georg.dev · 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.

1 likes 2 replies

?

Replies

Georg Unterholzner · Mar 5

Alternatively, I could think of restricting the child components' type (it’s a TypeScript library anyway). Then, I could inject the property into the child, and it would just automagically work. I’ve done this countless times in Angular libs. I'm not sure if this is a thing in React, though. 🤷

Andreas · Mar 5

What is so bad about a second export?