Skip to content

can't use react-redux with ink #1457

Closed
Closed
@mprast

Description

@mprast

Do you want to request a feature or report a bug?
report a bug
(If this is a usage question, please do not post it here—post it on Stack Overflow instead. If this is not a “feature” or a “bug”, or the phrase “How do I...?” applies, then it's probably a usage question.)

What is the current behavior?
I'm trying to use react-redux with ink and yarn v2. When I attempt to import Provider I'm met with the following:


Error: A package is trying to access another package without the second one being listed as a dependency of the first one

Required package: react-dom (via "react-dom")
Required by: react-redux@virtual:3acb2abc1dfd4a22564c3a11c8c371d7f85acb8e75efb297111ee893174e7ed007fb72514c7f7294775b8562215f979c751a99c9108a7c4c8e007fc4f67cd244#npm:7.1.3 (via /src/atlas/.yarn/virtual/react-redux-virtual-638efc0d6c/3/root/.yarn/berry/cache/react-redux-npm-7.1.3-f0c157eca3.zip/node_modules/react-redux/lib/utils/reactBatchedUpdates.js)

    at Object.makeError (/src/atlas/.pnp.js:13858:26)
    at resolveToUnqualified (/src/atlas/.pnp.js:16265:43)
    at resolveRequest (/src/atlas/.pnp.js:16311:31)
    at Object.resolveRequest.maybeLog [as resolveRequest] (/src/atlas/.pnp.js:16350:32)
    at Function.module_1.default._resolveFilename (/src/atlas/.pnp.js:15781:37)
    at Function.module_1.default._load (/src/atlas/.pnp.js:15702:45)
    at Module.require (internal/modules/cjs/loader.js:690:17)
    at require (internal/modules/cjs/helpers.js:25:18)
    at Object.<anonymous> (/src/atlas/.yarn/virtual/react-redux-virtual-638efc0d6c/3/root/.yarn/berry/cache/react-redux-npm-7.1.3-f0c157eca3.zip/node_modules/react-redux/lib/utils/reactBatchedUpdates.js:6:17)
    at Module._compile (internal/modules/cjs/loader.js:776:30)

I'm guessing it's because react-redux is trying to do a static import here:

import { unstable_batchedUpdates as batch } from './utils/reactBatchedUpdates'

If the current behavior is a bug, please provide the steps to reproduce and if possible a minimal demo of the problem. Your bug will get fixed much faster if we can run your code and it doesn't have dependencies other than React. Paste the link to a CodeSandbox (https://codesandbox.io/s/new) or RN Snack (https://snack.expo.io/) example below:

demo: https://codesandbox.io/s/festive-leftpad-cjr2w

What is the expected behavior?
I'm expecting to be able to use Redux without react-dom or react-native, since the impression I got from the docs is that react-redux doesn't or shouldn't have hard dependencies on a particular rendering library (if I'm mistaken and didn't miss something obvious it might be a good idea to add a disclaimer to the README!)

For now I can add react-dom as an easy workaround, but it'd be nice not to have the extra dependency just so I can import Provider and connect

Which versions of React, ReactDOM/React Native, Redux, and React Redux are you using? Which browser and OS are affected by this issue? Did this work in previous versions of React Redux?
React: 16.11.0
ReactDOM/React Native: N/A
ink: 2.5.0
Redux: 4.0.4
React Redux: 7.1.3

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions