question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Operational seems to have an issue with duplicating react

See original GitHub issue

According to this documentation: https://reactjs.org/warnings/invalid-hook-call-warning.html#duplicate-react

I have duplicate reacts, which is a problem.

$ npm ls react
ipfsplay@1.0.0 D:\code\ipfsplay
+-- @operational/components@18.0.0
| `-- react@16.14.0
`-- react@16.14.0

Here are my dependencies:

  "dependencies": {
    "@operational/components": "^18.0.0",
    "emotion": "^9.2.12",
    "react": "^16.14.0",
    "react-dom": "^16.14.0",
    "react-emotion": "^9.2.12"
  }

And its giving me this error:

Invalid hook call. Hooks can only be called inside of the body of a function component.

It seems weird that operational has its own react if react needs to be top level. Whats going on and how can I fix it?

Issue Analytics

  • State:closed
  • Created 3 years ago
  • Comments:9 (3 by maintainers)

github_iconTop GitHub Comments

1reaction
justinmchasecommented, Jan 16, 2021

LOL I found this in react:

image

I’m thinking about using it to set the dispatcher 🤔

0reactions
justinmchasecommented, Jun 10, 2021

I just encountered this again and the peer dependency versions in operational-ui are different than the actual versions it requires and it ends up causing this issue.

I’ll file a different bug but for the record I had to dig into the package.json under my node_modules folder and find the actual versions in there and install those exactly.

Read more comments on GitHub >

github_iconTop Results From Across the Web

React redirect on error avoiding code duplication
On each page on my app I make a request to the graphql client, const Profiles = () => { // Omitted code...
Read more >
Duplicate TypeScript fragment imports with React Apollo #3990
The issue seems to come in when the imports aren't identical in both files (not in the CodeSandbox I've just changed the order...
Read more >
It is not possible to react to an entity being duplicated - Drupal
1) Add a createDuplicate() method to Entity Storage, move the current logic there, call it from the entity class (just like we do...
Read more >
You Probably Don't Need Derived State – React Blog
All problems with derived state that we have seen can be ultimately reduced to either (1) unconditionally updating state from props or (2) ......
Read more >
Optimize React apps using a multi-layered structure
As you can see, FooComponent1 and FooComponent2 are affected by a code duplication issue. In particular, the API endpoint is being duplicated, ...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found