question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

componentWillReceiveProps is marked as deprecated

See original GitHub issue

https://github.com/leandrowd/react-responsive-carousel/blob/efcf86acdffc9ef929aff524eb17da8dd0890a36/src/components/Carousel.js#L94

With React 16.9 the lifecycle function “componentWillReceiveProps” is marked as deprecated will be even removed in React 17.

As you can read here https://fb.me/react-async-component-lifecycle-hooks

But there is a new lifecycle function

  static getDerivedStateFromProps(props, state) {
    // ...
  }

Are there any plans to update the library soon?

Issue Analytics

  • State:closed
  • Created 4 years ago
  • Comments:5 (2 by maintainers)

github_iconTop GitHub Comments

1reaction
drbeatcommented, Aug 15, 2019

As I have pointed out the correct way to change this is to replace “componentWillxxx” with “static getDerivedStateFromProps”.

0reactions
leandrowdcommented, Sep 9, 2019

Not a good idea to ask for context on this implementation as it has been written over 4 years ago so sorry but I can’t help. I would need to investigate possible solutions but I’m short on time to be honest.

I’m happy to review any pull requests and publish the package on my next available spare time. Other than that, unfortunately, you are on your own.

Read more comments on GitHub >

github_iconTop Results From Across the Web

reactjs - why is componentWillReceiveProps deprecated?
componentWillReceiveProps is a synchronous hook. Calling asynchronous function like data fetching inside this hook will need to render in ...
Read more >
React.Component
In the event of an error, you can render a fallback UI with componentDidCatch() by calling setState , but this will be deprecated...
Read more >
componentWillReceiveProps will be deprecated in the future
The use of componentWillReceiveProps will be deprecated in the future major version of react (17). The current react version throws a ...
Read more >
React17, or how to get rid of “componentWillReceiveProps”?
As you may already know, with the release of React 16.3, some of legacy lifecycles were deprecated. One of the biggest lessons we've...
Read more >
Deprecated life cycle methods - Learn React with TypeScript 3 ...
There are a few life cycle methods that have been deprecated and renamed in React 17. We don't need to use these anymore—...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found