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

bug: Geting Error : Support for defaultProps will be removed from function components in a future major release. Use JavaScript default parameters instead. #261

Closed
HeppyAndriawan opened this issue Apr 13, 2023 · 2 comments

Comments

@HeppyAndriawan
Copy link

HeppyAndriawan commented Apr 13, 2023

First of all, I am creating the app using Next.js 13 with the app directory. During development I get an error while I use Switch, Default, and Case components from React-if and the error says:

" Support for defaultProps will be removed from function components in a future major release. Use JavaScript default parameters instead. "

Here is my code:

code

and when I delete the React-if component then the error disappears.

Also, regarding this announcement (reactjs/rfcs#107) that is true defaultProps will be moved to class render in React.

So can anyone update the module or tell me how to fix this error manually?

Thanks

@favna
Copy link
Collaborator

favna commented Apr 13, 2023

Hai, thanks for the report. I was unaware of this React RFC. Do you think you can make a PR to fix the issue? The relevant code is this and it's also used in some of the other files: https://github.com/romac/react-if/blob/master/src/Case.tsx#L12-L14

I'm pretty busy on average so if you can make a PR that would be great, if not then I'll get around it eventually but I cannot promise when.

@favna
Copy link
Collaborator

favna commented Jun 29, 2023

Resolved in #279

@favna favna closed this as completed Jun 29, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants