`componentWillReceiveProps` is deprecated

componentWillReceiveProps is deprecated. When will you update this page?

Link to the challenge:

There is an ongoing discussion about this. In the short term it is not a big issue because CWRP will still exist in a lot of code and will continue to be useable until React 17. Remember that people don’t automatically run out and update themselves to the latest React every time an update occurs. At work we are slightly behind on various packages for fear that upgrading could break something. There is still a lot of code out there in COBOL for crap’s sake. And by the time the student finishes the FCC React program, they will be able to handle the deprecation and new functions.

I’m sure this will get addressed in a future version. You can also go to the repo and contribute if you wish.

Thank you for your quick response. I use FreeCodeCamp as the main reference in the course I teach. componentWillReceiveProps is confusing for students. After learning how to use Redux in their apps, I don’t think there is any use-case for componentWillReceiveProps. That’s why I propose removing it. Is there any use-cases that I’m not aware of?

I’ve had to use it in some apps - it really depends on what version of React you’re on. And more importantly, they may have to work in code that other people have written, maybe in earlier forms of React. As devs, we don’t always get to choose the tools that we use. In dev work it is very common to run across people using old versions of libraries.

And again, if you understand how lifecycle methods work, this is not hard to understand. It’s just a function. And if you really, really don’t want to teach it, you don’t need to.

But ultimately this forum isn’t the right place for this debate. This forum is for helping people with coding problems. There is an issue about this exact subject in the repo. This is a volunteer organization so you are more than welcome to do a join the discussion and do a PR on it.

1 Like

Yeah, this is something that came up in my bootcamp… tech moves fast, changes and updates happen all the time. There was a day when we started a Rails lesson, and all of the students were having issues…turned out, there was an update that morning, so our package was the new version, and it was causing issues in our code trying to follow along.

It kind of led to a discussion about this topic…not only with newer versions, but also new libraries and such…it made sense to us that we should know all the new stuff…but my instructor pointed out, there are so many companies out there working on much older versions and not hopping on the newest latest thing precisely because they are afraid it will break everything they already have. So while its good to learn whats new, its also good to be aware of and know older methods too.

1 Like

kevinSmith and cndragn Thanks for your responses.