Skip to content
This repository has been archived by the owner on Jul 1, 2020. It is now read-only.

Support new Context API #4

Merged
merged 3 commits into from
Apr 2, 2019

Conversation

overlookmotel
Copy link
Contributor

@overlookmotel overlookmotel commented Jan 6, 2019

This PR is my first stab at a solution to #2, supporting React's new Context API which is what React Router etc use.

I've succeeded in making it automatic - you don't need to declare the contexts in use. But that comes at the cost of monkey-patching React's .createContext() method to record all contexts in use. To activate the shim which makes it work, you need to do require('react-ssr-error-boundary/server').shim().

Alternatively, contexts can be added manually with require('react-ssr-error-boundary/server').useContext().

It needs some tidying up and I'd intend to write more tests, but is this PR something you'd consider merging?

@zekchan zekchan merged commit 6c38641 into zekchan:master Apr 2, 2019
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