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

Warning: componentWillReceiveProps has been renamed #134

Closed
julien51 opened this issue Jan 11, 2021 · 22 comments · Fixed by #172
Closed

Warning: componentWillReceiveProps has been renamed #134

julien51 opened this issue Jan 11, 2021 · 22 comments · Fixed by #172

Comments

@julien51
Copy link

It appears that QRCodeCanvas uses a deprecated method.

    1: "Warning: componentWillReceiveProps has been renamed, and is not recommended for use. See https://reactjs.org/link/unsafe-component-lifecycles for details.·
    * Move data fetching code or side effects to componentDidUpdate.
    * If you're updating state whenever props change, refactor your code to use memoization techniques or move it to static getDerivedStateFromProps. Learn more at: https://reactjs.org/link/derived-state
    * Rename componentWillReceiveProps to UNSAFE_componentWillReceiveProps to suppress this warning in non-strict mode. In React 18.x, only the UNSAFE_ name will work. To rename all deprecated lifecycles to their new names, you can run `npx react-codemod rename-unsafe-lifecycles` in your project source folder.·
    Please update the following components: %s", "QRCodeCanvas"

Is this a known issue?

@helloitsm3
Copy link

Yes. I've created a pull request and hopefully he'll accept it.

@zpao zpao linked a pull request Jan 16, 2021 that will close this issue
@zpao
Copy link
Owner

zpao commented Jan 16, 2021

FWIW, this is only a dev mode issue. As noted in the PR, will take a look soon and figure out how to go about versioning.

@antonenkokrg
Copy link

same problem

@dasMoeppi
Copy link

Same here, I would appreciate a fix any time soon. :)

@AndyRN
Copy link

AndyRN commented Mar 17, 2021

This package is great, would love to see the deprecation warning resolved 👍

@trouba
Copy link

trouba commented Apr 19, 2021

Hello, any news on this ?

@LukeHardyLexacom
Copy link

Any update on this please?

@helloitsm3
Copy link

@zpao

@xinaesthete
Copy link

This is pretty annoying noise during dev.

@trm217
Copy link

trm217 commented Jun 10, 2021

This is indeed very annoying. I would appreciate it, if this could be resolved. The PR has been open for 5 months.

@trouba
Copy link

trouba commented Jun 10, 2021

@trm217 Took me 10mn to switch to this lib https://github.com/rosskhanas/react-qr-code#readme

@xinaesthete
Copy link

@trm217 Took me 10mn to switch to this lib https://github.com/rosskhanas/react-qr-code#readme

I was actually using that and I think it took me less than 10 minutes to switch to this when for some reason it was giving me some trouble with my npm/vite configuration.

@boillatlucas
Copy link

Hello, any news on this ?

@jyboy
Copy link

jyboy commented Aug 13, 2021

Any updates?

@BlairSweigman
Copy link

Just tried it today on my 17.0.2, same error. I guess they gave up after version 1.0.1

@lanchana
Copy link

lanchana commented Oct 6, 2021

+1

1 similar comment
@anapanadero
Copy link

+1

@artola
Copy link

artola commented Dec 7, 2021

@zpao Any update on this? We have some PR already ongoing, can be merged? It is just a few lines if we are not be backward compatible, may be just publish a new version for such breaking change.

static getDerivedStateFromProps(props, state) {
    const currentSrc = state.imageSrc;
    const nextSrc = props.imageSettings?.src;

    if (currentSrc !== nextSrc) {
      return {imgSrc: nextSrc, imgLoaded: false};
    }
  }

@pucitos
Copy link

pucitos commented Dec 16, 2021

+1

darekkay added a commit to darekkay/dashboard that referenced this issue Dec 25, 2021
- Native TS support
- Better maintained
- Removes React 16 warning: zpao/qrcode.react#134
@AustinRhoads
Copy link

Any update????

@zpao
Copy link
Owner

zpao commented Feb 23, 2022

There's no way to fix this and support the same version range (down to 15.x), so I'm not going to in this major version (1.x). In order to use the unsafe_* lifecycle methods, I'd have to bump that lowest support version to 16.3.

I have a rewrite pending which will have a lower bound of React 16.8 (using hooks), which you can track in #169.

@AustinRhoads
Copy link

AustinRhoads commented Feb 23, 2022 via email

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet