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

Ditch defaultProps since it'll be deprecated in the future #277

Closed
Tracked by #21415
brionmario opened this issue Oct 8, 2024 · 0 comments · Fixed by #281
Closed
Tracked by #21415

Ditch defaultProps since it'll be deprecated in the future #277

brionmario opened this issue Oct 8, 2024 · 0 comments · Fixed by #281
Assignees
Labels
hacktoberfest Issues dedicated for the annual annual Hacktoberfest open source festival. package:react Issues/PRs related to the `@oxygen-ui/react` package. Type/Improvement

Comments

@brionmario
Copy link
Member

brionmario commented Oct 8, 2024

Is your suggestion related to an experience ? Please describe.

defaultProps on functional components will be deprecated in the future.
See: facebook/react#16210

Describe the improvement

Ditch defaultProps and use the ES6 syntax.

- const AccordionDetails: ForwardRefExoticComponent<AccordionDetailsProps> & WithWrapperProps = forwardRef(
  (props: AccordionDetailsProps, ref: MutableRefObject<HTMLDivElement>): ReactElement => {
-    const {className, ...rest} = props;
+ const AccordionDetails: ForwardRefExoticComponent<AccordionDetailsProps> & WithWrapperProps = forwardRef(
  ({ enabled = true}: AccordionDetailsProps, ref: MutableRefObject<HTMLDivElement>): ReactElement => {
- AccordionDetails.defaultProps = {
    enabled: true
};

Additional context

N/A

@brionmario brionmario self-assigned this Oct 8, 2024
@brionmario brionmario added Type/Improvement package:react Issues/PRs related to the `@oxygen-ui/react` package. hacktoberfest Issues dedicated for the annual annual Hacktoberfest open source festival. labels Oct 8, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
hacktoberfest Issues dedicated for the annual annual Hacktoberfest open source festival. package:react Issues/PRs related to the `@oxygen-ui/react` package. Type/Improvement
Projects
None yet
1 participant