Skip to content

Warning: componentWillReceiveProps has been renamed #3720

Closed

Description

@IftekherSunny

Getting this warning !!!!

Warning: componentWillReceiveProps has been renamed

Screenshot

Activity

  1. eugene-tea commented on Aug 16, 2019

    @eugene-tea
    Contributor
    react-dom.development.js:11494 Warning: componentWillReceiveProps has been renamed, and is not recommended for use. See https://fb.me/react-async-component-lifecycle-hooks 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://fb.me/react-derived-state
    * Rename componentWillReceiveProps to UNSAFE_componentWillReceiveProps to suppress this warning in non-strict mode. In React 17.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: Select
    
  2. jakeboone02 commented on Aug 16, 2019

    @jakeboone02
    Contributor

    This is fixed by #3487.

  3. NordlingDev commented on Aug 23, 2019

    @NordlingDev

    @jakeboone02 - I'm on version 3.0.4 and it still warns about this. I can even see it being used in the source code?

  4. oscarteg commented on Aug 23, 2019

    @oscarteg

    @NordlingDev That is because @jakeboone02 references a pullrequest but the pullrequest is not merged yet.

  5. rachelleahr commented on Aug 23, 2019

    @rachelleahr

    Any idea when this will be merged? trying to remove these warnings...

  6. oscarteg commented on Aug 23, 2019

    @oscarteg

    @rachelleahr Pull request #3716 fixes it and is merged, but I don't know when it will be released.

  7. absenteerealitycheck commented on Aug 29, 2019

    @absenteerealitycheck

    Any news on when this will be released?

  8. rachelleahr commented on Aug 29, 2019

    @rachelleahr

    @gwyneplaine When is the next release planned?

  9. dbsimeonov commented on Sep 3, 2019

    @dbsimeonov

    Does anybody know what is the solution for it? Still having this warning

  10. isggwp commented on Sep 18, 2019

    @isggwp

    it fixed? but I have installed react 16.9.0 and react-select 3.0.4 using NPM. and I still got the warning

    componentWillReceiveProps has been renamed, and is not recommended for use. See https://fb.me/react-async-component-lifecycle-hooks for details.
    
    
  11. Kiyozz commented on Sep 18, 2019

    @Kiyozz

    Not fixed atm

  12. yanlee26 commented on Sep 18, 2019

    @yanlee26

    1

  13. ranneyd commented on Sep 19, 2019

    @ranneyd

    +1

  14. ranneyd commented on Sep 20, 2019

    @ranneyd
  15. ranneyd commented on Sep 25, 2019

    @ranneyd

    So I'm going to drop this here.

    https://www.npmjs.com/package/react-select-temp

    I'm not happy about it either. I'm just using this to make the warning go away until the maintainers in this lib sort this out. I'm going to continue to monitor the threads and switch back to the real package once this one is ready.

    I just took this PR, published to NPM, then updated this lib to use that one.
    JedWatson/react-input-autosize#167

    Everything we need to make this warning go away exists. We just need the maintainers of this lib to press some buttons.

  16. 8 remaining items

  17. mreishus commented on Oct 24, 2019

    @mreishus

    Looks like there are still some React Strict Mode warnings being generated as of the latest version today (3.0.8). There's an issue for them here: #3745

  18. An1mus commented on Dec 11, 2019

    @An1mus

    +1

  19. vedees commented on Dec 24, 2019

    @vedees

    With the release of React 16.3, some new lifecycle methods have been introduced, and release of React 17 will deprecate some lifecycle method.

    getDerivedStateFromProps is one of those newly introduced lifecycle method replacing componentWillReceiveProps, which has now become UNSAFE_componentWillReceiveProps.

    Solution: rename componentWillReceiveProps to UNSAFE_componentWillReceiveProps or use getDerivedStateFromProps but this option will need refactoring your code. prefect solutuon: do not use classes

  20. ljharb commented on Dec 24, 2019

    @ljharb

    Note that renaming to "UNSAFE_" is a breaking change since it drops support for < 16.3.

  21. JanaSundar commented on Apr 16, 2020

    @JanaSundar

    Getting this warning in version 3.1.0

    index.js:1 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.

    • 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://fb.me/react-derived-state

    Please update the following components: AutosizeInput, Select

  22. luanfelipecosta commented on Apr 17, 2020

    @luanfelipecosta

    Why the issue is closed then? Im still getting error in 3.1.0.

  23. AbelFuentes commented on Apr 19, 2020

    @AbelFuentes

    3.1.0 and still with issues...

  24. razh commented on Apr 19, 2020

    @razh
    • These warnings are appearing because you are running in <React.StrictMode>.
    • create-react-app v3.4.1 enabled <React.StrictMode> by default. It was released about one month ago.
    • This issue was closed because it was resolved for the case where strict mode is not enabled.
    • There is currently a rewrite in progress to remove these deprecated lifecycle methods.
  25. reopened this on Jun 18, 2020
  26. bladey commented on Jun 18, 2020

    @bladey
    Contributor

    Hi all,

    Thank you to everyone who has provided information above.

    As you may be aware, this bug has been reported multiple times as per issue #4094. On behalf of the maintainers I apologise it's taken awhile to get to this.

    A new master issue #4094 has since been created to help keep track of this bug going forward.

    This new issue will exist as the source of truth going forward to investigate the issue, report findings, and implement a bug fix.

    We'll take into account all the details above while investigating.

    If you feel this issue has been wrongly closed as it isn't related to the new master issue #4094, please let us know and we'll take another look.

    Again, thank you.

  27. mihailsitnic commented on Aug 21, 2020

    @mihailsitnic

    Try to replace ur index.js file

    From:
    ReactDOM.render( <React.StrictMode> <App /> </React.StrictMode>, document.getElementById('root') );

    To:
    ReactDOM.render(<App />, document.getElementById('root'));

    Or:
    ReactDOM.render( <Provider store={store}> <App /> </Provider>, document.getElementById('root') )

  28. tomsarduy commented on Mar 21, 2023

    @tomsarduy

    Happy 2023... any news on this? 👀

  29. Methuselah96 commented on Mar 21, 2023

    @Methuselah96
    Collaborator

    It should be fixed in the latest version of react-select.

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

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions