diegomura / diegomura/react-pdf

React Context not handled correctly (react-redux and react-intl)

Open
#522 20 comments 0 reactions 0 assignees View on GitHub
blocked bug
Dominant language
TypeScript
Stars
16.8k
Forks
1.3k
Avg merge
5h 6m
Merged PRs (30d)
52

Description

**Describe the bug**
I am using react-redux and react-intl, which both use a provider component and react's context.

When I use a component, in this case on that is connected to the redux store, I get the following error:

> Invariant Could not find "store" in the context of "Connect(Compoment)". Either wrap the root component in a , or pass a custom React context provider to and the corresponding React context consumer to Connect(Compoment) in connect options.

Found [an issue with react-router](https://github.com/reduxjs/react-redux/issues/57), which could be important here:

> If you use React Router, something like {() => routes} won’t work. Due to the way context works in React 0.13, it’s important that the children are created inside that function. Just referencing an outside variable doesn’t do the trick. Instead of {() => routes}, write {createRoutes} where createRoutes() is a function that actually creates (and returns) the route configuration.

**To Reproduce**
Steps to reproduce the behavior including code snippet (if applies):
1. use a component that uses react's context within react-pdf components
2. exception is thrown

(I have no time to create a minimal code snippet now, but could do so if someone needs it)

**Expected behavior**
react-pdf should be able to render components, that rely on reacts context api

**Desktop (please complete the following information):**
- OS: linux, Gentoo Linux
- Browser: chrome and firefox
- React-pdf/renderer version: v1.4.0

Contributor guide

Open the contributing guide

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.