Repository navigation
|
TD;DR question: are there any potential problems/gotchas with nesting one EDIT: oh, hey, I had missed the existence of this Nested Providers page in the guides section: https://theme-ui.com/guides/nested-theme-providers — sounds like it's an expected usage pattern so unlikely to cause problems. Context: Our team has a component library built on top of We have one customer-facing legacy app in production that is not a full React app but it does have certain spots where it uses standalone React roots. We recently produced a more complex shared component, managed in its own repo and published as a package, that uses a lot of the library components, and it gets used in both the React and non-React apps. This package specifies our component library as a We're undecided, though, if it makes the most sense to make sure this packaged component includes a Interested to hear the opinions of the maintainers/community about this. |
Replies: 1 comment 1 reply
|
Yes, nesting providers is expected, but don't overdo it. Every context provider and consumer has some impact on perf. You also may want to use the https://theme-ui.com/packages/core#theme-uicore If this component is |
Yes, nesting providers is expected, but don't overdo it. Every context provider and consumer has some impact on perf.
You also may want to use the
ThemeProviderfrom@theme-ui/corewhenever you're nesting and want to only merge contexts without any of the other setup.https://theme-ui.com/packages/core#theme-uicore
If this component is
Buttonor similar often used part of the design system, I wouldn't wrap it. If it's something likeBugReportFormorEmailComposerwhich's gonna be used once, wrapping it for convenient use in your other roots is definitely a valid move.