Skip to content
This repository was archived by the owner on Jan 10, 2025. It is now read-only.

react-shortcuts: export Provider for enabling external ShortcutProvider implementors#375

Merged
marutypes merged 3 commits intoShopify:masterfrom
thedeadtellnotales:publish-provider
Oct 26, 2018
Merged

react-shortcuts: export Provider for enabling external ShortcutProvider implementors#375
marutypes merged 3 commits intoShopify:masterfrom
thedeadtellnotales:publish-provider

Conversation

@emidoots
Copy link

The default ShortcutProvider is great for most React applications, but when
React is being rendered into multiple locations on a page (for example, in a
browser extension that extends multiple different locations on a page with
React
), the default ShortcutProvider does not work as it is intended to be a singleton.

In order to implement one's own ShortcutProvider for this use case, the ContextProvider
must be exported.

…er implementors

The default `ShortcutProvider` is great for most React applications, but when
React is being rendered into multiple locations on a page (for example, in a
browser extension that extends multiple different locations on a page with
React), the default `ShortcutProvider` does not work as it is intended to be a
singleton.

In order to implement one's own `ShortcutProvider` for this use case, the `ContextProvider`
must be exported.
Copy link
Contributor

@marutypes marutypes left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Ideally we could fix this more holistically, but this is probably an OK escape hatch to have as well.

We might want to add an FAQ to the README with an example of how to use a custom provider.

@marutypes marutypes merged commit 24cc2d0 into Shopify:master Oct 26, 2018
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants