react-vis icon indicating copy to clipboard operation
react-vis copied to clipboard

Support React 17

Open Xiot opened this issue 4 years ago • 11 comments

React 17 adds support for async rendering which will need some testing and tweaking to properly support.

It explicitly removes support for various lifecycle methods on class components:

componentWillReceiveProps
componentWillMount
componentWillUpdate

and moves to use the new ones

getDerivedStateFromProps
getSnapshotBeforeUpdate

These new methods, and the deprecation warnings were added back in 16.3.

Do do have a couple places that I believe are still using the old methods, although there was a pass to remove them.

Xiot avatar Jun 15 '20 15:06 Xiot

Looks like it does not remove these methods after all! Postponed to React 18+.

wojtekmaj avatar Aug 11 '20 14:08 wojtekmaj

Ya, so || ^17.0.0 needs to be added to the dependency ( see https://github.com/uber/react-vis/blob/cce5980cd29416bdae592b34f2e52a088176493c/packages/react-vis/package.json#L89 )

daveisfera avatar Feb 25 '21 02:02 daveisfera

Hi, I can't seem to install react-vis in a create-react-app project with React 17. Here's the npm error log, hope that helps!

npm ERR! code ERESOLVE npm ERR! ERESOLVE unable to resolve dependency tree npm ERR! npm ERR! While resolving: [email protected] npm ERR! Found: [email protected] npm ERR! node_modules/react npm ERR! react@"^17.0.2" from the root project npm ERR! npm ERR! Could not resolve dependency: npm ERR! peer react@"15.3.0 - 16.x" from [email protected] npm ERR! node_modules/react-vis npm ERR! react-vis@"*" from the root project npm ERR! npm ERR! Fix the upstream dependency conflict, or retry npm ERR! this command with --force, or --legacy-peer-deps npm ERR! to accept an incorrect (and potentially broken) dependency resolution.

karamvirsingh98 avatar Jun 07 '21 00:06 karamvirsingh98

Now that npm has overrides, I wonder if that could be used as a workaround in this case since this library is unmaintained?

https://docs.npmjs.com/cli/v8/configuring-npm/package-json#overrides

e.g.

  "overrides": {
    "react": "^17.0.0"

bmaupin avatar Jan 05 '22 19:01 bmaupin

Yes it could. I'm happily using react-vis with React 17 in production on a large scale commercial application with zero complaints. Hell, preparing to upgrade to React 18 as soon as it gets released, with RC being evaluated right now, and everything still works just fine.

wojtekmaj avatar Jan 05 '22 20:01 wojtekmaj

@wojtekmaj Since npm overrides were just added, how are you using react-vis with React 17? Seems like I wasn't even able to upgrade React with react-vis as a dependency. Are you using a different package manager?

bmaupin avatar Jan 05 '22 21:01 bmaupin

I'm using Yarn, but you can skip peer deps check in NPM with a flag, too.

wojtekmaj avatar Jan 05 '22 22:01 wojtekmaj

@wojtekmaj Ah ok. I think the new npm overrides feature is probably better for something like this since it can be configured in package.json without having to use any special flags every time (which I would probably forget). But it's always good to have options. Thanks!

bmaupin avatar Jan 06 '22 13:01 bmaupin

@bulyonov Would it be possible for you to address this issue?

tp00012x avatar Feb 17 '22 02:02 tp00012x

Bumping this again, would be extremely useful to support React 17 or 18

ndrewtl avatar Jul 10 '23 18:07 ndrewtl

We have been using React 17 for a while with react-vis without any problems, but updating to React 18 throws plenty of typesript errors. So I created separate issue for 18: https://github.com/uber/react-vis/issues/1485

jkytomak avatar Nov 14 '23 11:11 jkytomak