Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Hooks API - Context #16

Open
bryphe opened this issue Jan 29, 2019 · 0 comments
Open

Hooks API - Context #16

bryphe opened this issue Jan 29, 2019 · 0 comments

Comments

@bryphe
Copy link
Contributor

bryphe commented Jan 29, 2019

Was just working on porting Oni2 over to the latest Revery + Brisk reconciler, and reminded me of the context issue. We're using context right now to provide a context-based ThemeProvider.

A potential API could look like:

  • createContext: 'a -> context('a)
  • Hooks.useContext: context('a) -> 'a
  • getProvider: context('a) -> providerComponent('a)

I believe handling the typing correctly in terms of passing the nested context down will be challenging - so we might need to alter the API to make it workable in a strongly-typed environment w/o resorting to Obj.magic.

Not a blocker, I'll workaround it, but just wanted to log an issue to start the discussion.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant