mac-s-g / react-json-view

JSON viewer for react
https://mac-s-g.github.io/react-json-view/demo/dist/
MIT License
3.42k stars 530 forks source link

Doesn't support React 18? #441

Open punit1108 opened 1 year ago

punit1108 commented 1 year ago

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 commented 1 year ago

same here

ornic commented 1 year ago

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

Dilven commented 1 year ago

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 commented 1 year ago

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 commented 1 year ago

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 commented 1 year ago

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 commented 1 year ago

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

luixo commented 1 year ago

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 commented 1 year ago

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

le-phone commented 1 year ago

+1

Draym commented 1 year ago

+1

YYsuni commented 1 year ago

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

image

jaywcjlove commented 1 year ago

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 commented 1 year ago

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 commented 10 months ago

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 😅