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

Doesn't support React 18? #441

Open
punit1108 opened this issue Jan 20, 2023 · 15 comments
Open

Doesn't support React 18? #441

punit1108 opened this issue Jan 20, 2023 · 15 comments

Comments

@punit1108
Copy link

I tried to install the library in one of my applications, which runs on react 18. But i got the following error -

Screenshot 2023-01-20 at 11 35 40 AM

Does it not support React 18?

@ralcant
Copy link

ralcant commented Jan 25, 2023

same here

@ornic
Copy link

ornic commented Jan 26, 2023

It working via --legacy-peer-deps npm switch.

@Dilven
Copy link

Dilven commented Feb 2, 2023

It working via --legacy-peer-deps npm switch.

a better solution is to override this in package.json

{
  "dependencies": {
    "react": "^18.2.0",
    "react-dom": "^18.2.0",
    "react-json-view": "^1.21.3"
  },
  "overrides": {
    "react-json-view": {
      "react": "$react",
      "react-dom": "$react-dom"
    }
  }
}

@kdesmondfaa
Copy link

It working via --legacy-peer-deps npm switch.

a better solution is to override this in package.json

{
  "dependencies": {
    "react": "^18.2.0",
    "react-dom": "^18.2.0",
    "react-json-view": "^1.21.3"
  },
  "overrides": {
    "react-json-view": {
      "react": "$react",
      "react-dom": "$react-dom"
    }
  }
}

This is not working for me. I am still getting the same error.

@DustinKLo
Copy link

It working via --legacy-peer-deps npm switch.

a better solution is to override this in package.json

{
  "dependencies": {
    "react": "^18.2.0",
    "react-dom": "^18.2.0",
    "react-json-view": "^1.21.3"
  },
  "overrides": {
    "react-json-view": {
      "react": "$react",
      "react-dom": "$react-dom"
    }
  }
}

This is not working for me. I am still getting the same error.

did you update your version of npm, overrides was added in v8.3.0
https://stackoverflow.com/a/70396201

@kdesmondfaa
Copy link

It working via --legacy-peer-deps npm switch.

a better solution is to override this in package.json

{
  "dependencies": {
    "react": "^18.2.0",
    "react-dom": "^18.2.0",
    "react-json-view": "^1.21.3"
  },
  "overrides": {
    "react-json-view": {
      "react": "$react",
      "react-dom": "$react-dom"
    }
  }
}

This is not working for me. I am still getting the same error.

did you update your version of npm, overrides was added in v8.3.0 https://stackoverflow.com/a/70396201

Hey thanks, I was on v8.1

@himself65
Copy link

please try https://github.com/Himself65/data-viewer

@luixo
Copy link

luixo commented Mar 24, 2023

It working via --legacy-peer-deps npm switch.

a better solution is to override this in package.json

{
  "dependencies": {
    "react": "^18.2.0",
    "react-dom": "^18.2.0",
    "react-json-view": "^1.21.3"
  },
  "overrides": {
    "react-json-view": {
      "react": "$react",
      "react-dom": "$react-dom"
    }
  }
}

Unfortunately, this doesn't work if react-json-view is in npm workspace.

@fatihyildizhan
Copy link

I also couldn't fix with --legacy-peer-deps.

@le-phone
Copy link

+1

1 similar comment
@Draym
Copy link

Draym commented Apr 26, 2023

+1

@YYsuni
Copy link

YYsuni commented Apr 27, 2023

Hey there! You might want to give this one a try: https://github.com/YYsuni/react18-json-view

image

@jaywcjlove
Copy link

jaywcjlove commented Jun 20, 2023

Github: https://github.com/uiwjs/react-json-view
Website: https://uiwjs.github.io/react-json-view

react-json-view react-json-view image

Size and dependencies

Here is the size benchmark (using bundlephobia.com) against similar React libraries (found by npmjs.com/search):

Library Bundle size Bundle size (gzip) Deps Last commit
@uiw/react-json-view GitHub last commit
react-json-view-lite GitHub last commit
react-json-pretty GitHub last commit
react-json-inspector GitHub last commit
react-json-tree GitHub last commit
react-json-view GitHub last commit
react-json-tree-viewer GitHub last commit
react-domify GitHub last commit
react18-json-view GitHub last commit

@YYsuni
Copy link

YYsuni commented Aug 23, 2023

Hey there! You might want to give this one a try: https://github.com/YYsuni/react18-json-view

Look, I have added an editable feature and updated icons. Please feel free to submit an issue if you encounter any problems.

image

@Kecbm
Copy link

Kecbm commented Nov 1, 2023

It working via --legacy-peer-deps npm switch.

a better solution is to override this in package.json

{
  "dependencies": {
    "react": "^18.2.0",
    "react-dom": "^18.2.0",
    "react-json-view": "^1.21.3"
  },
  "overrides": {
    "react-json-view": {
      "react": "$react",
      "react-dom": "$react-dom"
    }
  }
}

@Dilven Thank you very much for sharing this solution. Saved my deploy from a frontend competition 😅

ckniffen added a commit to ripple/explorer that referenced this issue Jan 5, 2024
This PR replaces `react-json-view` with `react18-json-view`. This
results in 18 less dependencies and a 2kb smaller gzipped bundle.

There were a few small tweaks to the json view themes to use the closest
color within the sites color palette (previously they were one offs) and
margins/padding.

### Context of Change

`react-json-view` doesn't work with React 18 and is also much bigger
than `react18-json-view`. Related to #668.

mac-s-g/react-json-view#441

Co-authored-by: Caleb Kniffen <[email protected]>
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