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
React: Update lesson to remove defaultProps
#27882
Comments
Thanks for making this issue! Can you link to where the React team has stated more info about the defaultProps deprecation? I see some chatter about it on GH issues and an RFC but nothing definitively stating the plan. |
@wise-king-sullyman If you copy-paste the example in the Default Props heading in the react environment you will get an error/warning in the console telling you the |
But has there been anything more definitive than that? If not I'd be pretty hesitant to remove I wouldn't be opposed to a note or something about the warning being added to our lesson so that learners know not to worry about it. |
@wise-king-sullyman There has been a mention on the react blog about it |
Thanks @gingkapls! Since 19 is probably not too far away I'm not opposed to an update here to put us a bit ahead of the curve. I would definitely still like to see us cover |
@wise-king-sullyman So to confirm. We want to add a short note on the potential depreciation of the |
I would actually refactor the section to lead with the default params example, then after that have a paragraph that just kind of briefly covers what And maybe add a bit to the class components lesson that mentions |
Interesting thing about |
The blog post also mentions that I agree with wise-king-sullyman that removing either or both entirely is not the way to go, since maintaining old code-bases could be a significant part of someone's work, and not many places would be switching to React 19 just yet. Though, I feel that making any modifications to the content related to Not sure if sprinkling the section with notes about it being deprecated is the way to go either though. |
My initial reading of that blog was that they're actually removing proptypes from the React object (i.e. they deprecated that in v15.5 after extracting them to a separate package) and only now are they actually removing them from the React object. But on a second read, it looks like they're straight up removing propTypes from v19 altogether, i.e. using propTypes would do literally nothing. I think in the grand scheme of things, the team will have to discuss this is more detail, as undoubtedly, the release of v19 and later on when the React compiler gets shipped (and useMemo/useCallback will be deprecated), we may need to do some slightly larger adjustments to the way some lessons are handled/framed. I think propTypes are still valuable to bring up in the curriculum, just like class components. Even if you won't likely be making new applications using them, professionally, it's more than reasonable to end up working with a codebase that does use them. The difference in our curriculum would be how we frame the propTypes lesson, if v19 silently ignores them, i.e. renders proptypes non-functional. |
I'm new to the React course, and while practicing I'm finding most of the discussions here a bit complex, especially since |
@wise-king-sullyman What do you think about reversing the order of the Currently it starts by showing Perhaps it may be simpler here to just start by showing the default param approach, then at the end of it say "you may also come across @headlessNode sorry if me bringing up propTypes caused some confusion for you 😅 Was mainly just noting an interesting difference between the defaultProps and default params (since propTypes will also be affected in v19, but that's a separate thing to address). |
Checks
Describe your suggestion
React has announced that support for
defaultProps
in function components will be deprecated in a future major release. We should update the lesson Passing Data Between Components to reflect the upcoming deprecation ofdefaultProps
.Path
Node / JS
Lesson Url
https://www.theodinproject.com/lessons/node-path-react-new-passing-data-between-components
(Optional) Discord Name
headlessNode
(Optional) Additional Comments
No response
The text was updated successfully, but these errors were encountered: