Skip to content

Warnings: componentWillReceiveProps in strict mode, Legacy context API, findDOMNode is deprecated #4094

Closed

Description

@bladey

This issue is a round-up of multiple past issues documenting the same bug. Feel free to check out the linked issues below for more information. This issue is the source of truth going forward to investigate the issue, report findings, and implement a bug fix.

Issue:

W35yYs

Warning: Using UNSAFE_componentWillReceiveProps in strict mode is not recommended and may indicate bugs in your code. See https://fb.me/react-unsafe-component-lifecycles for details.
Warning: Legacy context API has been detected within a strict-mode tree.

The old API will be supported in all 16.x releases, but applications using it should migrate to the new version.
Warning: findDOMNode is deprecated in StrictMode. findDOMNode was passed an instance of NodeResolver which is inside StrictMode. Instead, add a ref directly to the element you want to reference. Learn more about using refs safely here: https://fb.me/react-strict-mode-find-node

Issues:

#3751
#3720
#3915
#3745
#4068
#3703

If anyone would like to share any further information, please do so.

Activity

  1. added
    issue/bug-confirmedIssues about a bug that has been confirmed by a maintainer
    issue/reviewedIssue has recently been reviewed (mid-2020)
    on Jun 18, 2020
  2. self-assigned this
    on Jun 18, 2020
  3. giangr21 commented on Jun 18, 2020

    @giangr21
  4. Sine99 commented on Jun 19, 2020

    @Sine99
  5. manvydasu commented on Jun 19, 2020

    @manvydasu
    Contributor

    So basically someone would have to create a PR and replace legacy component lifecycle methods with newer version: https://reactjs.org/blog/2018/03/27/update-on-async-rendering.html#migrating-from-legacy-lifecycles

    However, looking at usages and code inside of UNSAFE_componentWillReceiveProps , it might not be so straightforward.

  6. stak99 commented on Jun 28, 2020

    @stak99
  7. corysimmons commented on Jun 29, 2020

    @corysimmons

    For anyone else going insane over this, you can disable those warnings (and other, actually helpful ones) by commenting out <React.StrictMode> in index.js. Just remember to uncomment it a few times a day to get the helpful warnings.


    Update: Stop confused-face'ing me you monsters! 😭

  8. martijnhalekor commented on Jul 15, 2020

    @martijnhalekor
  9. roberto-souza commented on Jul 20, 2020

    @roberto-souza
  10. OlegPuzankin commented on Jul 24, 2020

    @OlegPuzankin

    Can anyone say - are these warnings critical and can we expect the developers to fix that in the future?

  11. corysimmons commented on Jul 24, 2020

    @corysimmons

    @OlegPuzankin They aren't critical in React 16.x.x, in React 17+ I suspect all the deprecated UNSAFE_xyz methods will be removed so any libraries depending on those methods will stop working.

    Yes, the maintainer is aware of it and has it on their todo list.

  12. added
    issue/reviewedIssue has recently been reviewed (mid-2020)
    and removed
    issue/reviewedIssue has recently been reviewed (mid-2020)
    on Aug 24, 2020
  13. BraveEvidence commented on Oct 24, 2020

    @BraveEvidence

    React v17 has been released. Someone please fix this issue

  14. 2 remaining items

  15. corysimmons commented on Nov 25, 2020

    @corysimmons

    @Methuselah96 Is that a drop-in replacement that won't spam the UNSAFE warnings?

    Edit: Seems to have the same UNSAFE warnings and others are submitting PRs to that project... so... why not just PR this project instead? 🤔

  16. Methuselah96 commented on Nov 25, 2020

    @Methuselah96
    Collaborator

    @corysimmons I haven't finished the changes necessary to remove the UNSAFE warnings in the fork.

    I didn't make a PR for this project, because at the time, it had been several months since any PR had been merged and half a year since a new version had been released. I planned on creating a PR once I had finished all the changes necessary.

    As long as this project is actually maintained, I'll make PRs here and hopefully archive my fork.

    EDIT: I've made a PR: #4313.

  17. bwilson commented on Nov 25, 2020

    @bwilson
  18. flora8984461 commented on Dec 2, 2020

    @flora8984461

    Have the same issue here.

  19. added this to the 3.2 milestone on Dec 2, 2020
  20. modified the milestones: 3.2, 4.0 on Dec 12, 2020
  21. Dezzymei commented on Jan 18, 2021

    @Dezzymei

    I am still getting this issue. I thought this was working with react 17?

  22. removed this from the 4.0 milestone on Jan 22, 2021
  23. linked a pull request that will close this issueRemove usages of UNSAFE React methods #4313on Jan 22, 2021
  24. corysimmons commented on Jan 22, 2021

    @corysimmons

    @Methuselah96 Thank you, Hero!

  25. Ochaun commented on Feb 25, 2021

    @Ochaun

    Still getting this issue on 4.1.0 for the Animated Select.

  26. ebonow commented on Feb 25, 2021

    @ebonow
    Collaborator

    @Ochaun this is being tracked in #4456

  27. added a commit that references this issue on Jun 15, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

Labels

issue/bug-confirmedIssues about a bug that has been confirmed by a maintainerissue/reviewedIssue has recently been reviewed (mid-2020)

Projects

No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions