Skip to content

fix: React warnings of "Support for defaultProps will be removed from function components in a future major release. Use JavaScript default parameters instead."#9453

Merged
char0n merged 2 commits intoswagger-api:masterfrom
firejune:master
Jan 4, 2024

Conversation

@firejune
Copy link
Copy Markdown
Contributor

@firejune firejune commented Jan 3, 2024

Remove deprecated warning that occurs in React 18.2.0.

Description

When I am trying to use swagger-ui with react@18.2.0 I am getting this warning. The React MR to print this warning on console is here.

Warning: {FunctionComponentName}: Support for defaultProps will be removed from function components in a future major release. Use JavaScript default parameters instead.

How Has This Been Tested?

I am pretty sure this is a small refactor to remove this warning and I could work on that 😄

Checklist

My PR contains...

  • No code changes (src/ is unmodified: changes to documentation, CI, metadata, etc.)
  • Dependency changes (any modification to dependencies in package.json)
  • Bug fixes (non-breaking change which fixes an issue)
  • Improvements (misc. changes to existing features)
  • Features (non-breaking change which adds functionality)

My changes...

  • are breaking changes to a public API (config options, System API, major UI change, etc).
  • are breaking changes to a private API (Redux, component props, utility functions, etc.).
  • are breaking changes to a developer API (npm script behavior changes, new dev system dependencies, etc).
  • are not breaking changes.

Documentation

  • My changes do not require a change to the project documentation.
  • My changes require a change to the project documentation.
  • If yes to above: I have updated the documentation accordingly.

Automated tests

  • My changes can not or do not need to be tested.
  • My changes can and should be tested by unit and/or integration tests.
  • If yes to above: I have added tests to cover my changes.
  • If yes to above: I have taken care to cover edge cases in my tests.
  • All new and existing tests passed.

@char0n
Copy link
Copy Markdown
Contributor

char0n commented Jan 4, 2024

Hi @firejune,

Thanks for the PR! Can you please remove all the ./dist/* changes from your PR? The ./dist directory should only be modified by the release process.

@char0n char0n self-assigned this Jan 4, 2024
@char0n char0n self-requested a review January 4, 2024 10:43
@firejune firejune force-pushed the master branch 11 times, most recently from 9dd3703 to 32afc13 Compare January 4, 2024 13:01
…s in a future major release. Use JavaScript default parameters instead. warning in React
@firejune
Copy link
Copy Markdown
Contributor Author

firejune commented Jan 4, 2024

Hi @char0n
Of course I can. I removed all changes in ./dist/*.

Copy link
Copy Markdown
Contributor

@char0n char0n left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM! Thank you for contributing!

@char0n
Copy link
Copy Markdown
Contributor

char0n commented Jan 4, 2024

@firejune just FYI: react@18 has been added in #9435

It hasn't been released yet, it will go out together with your change today/tommorow.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants