Skip to content
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 19] Need suggestion on upgrade. #30859

Open
lakshman0369 opened this issue Sep 2, 2024 · 2 comments
Open

[React 19] Need suggestion on upgrade. #30859

lakshman0369 opened this issue Sep 2, 2024 · 2 comments
Labels

Comments

@lakshman0369
Copy link

Summary

We are upgrading the react in our project and we see in the documentation the support for the defaultprops and proptypes is removed.

We are using the jsx and migrating to typescript is not possible at the moment as our project is fairly big. Any suggestion on how to do defaultprop and proptype check.

@VDXD
Copy link

VDXD commented Sep 2, 2024

You can use defaultprops and proptypes on your component or you can try JSDoc comments

@AlexTodorov11
Copy link

Here is something I came up with, along with some help form my AI agent. This is the short version - if you want the long one, let me know:

  • Use ES6 default parameters for setting default values in your functional components.
  • Continue using prop-types for runtime validation of props to prevent passing incorrect data types.
  • Plan for a gradual migration to TypeScript, as that will ultimately offer the strongest and most scalable type safety long-term.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

3 participants