Skip to content

fix(ResponsiveAction): resolve warning about accessing reserved 'key' prop#892

Merged
nicolethoen merged 1 commit intopatternfly:mainfrom
rhamilto:fix-responsive-action-key-prop-warning
Mar 27, 2026
Merged

fix(ResponsiveAction): resolve warning about accessing reserved 'key' prop#892
nicolethoen merged 1 commit intopatternfly:mainfrom
rhamilto:fix-responsive-action-key-prop-warning

Conversation

@rhamilto
Copy link
Copy Markdown
Member

Summary

Details

The ResponsiveAction component was incorrectly defining key as a prop in its interface, which caused React to warn when developers used the standard key prop pattern with arrays of ResponsiveAction components:

Warning: ResponsiveAction: `key` is not a prop. Trying to access it will result in `undefined` being returned.

Changes:

  1. ResponsiveAction.tsx: Removed key?: string; from the ResponsiveActionProps interface since key is a reserved React prop that cannot be accessed within components
  2. ResponsiveActions.tsx: Updated to use child.key (React's internal key accessor) instead of destructuring from child.props, which was triggering the warning

Test plan

  • All existing tests pass
  • Build completes successfully
  • No breaking changes - the component continues to work exactly as before, just without console warnings

🤖 Generated with Claude Code

… prop

Fixes patternfly#890

The ResponsiveAction component was incorrectly defining 'key' as a prop
in its interface, which caused React to warn when developers used the
standard key prop pattern with arrays of ResponsiveAction components.

Changes:
- Removed 'key' from ResponsiveActionProps interface since 'key' is a
  reserved React prop that cannot be accessed within components
- Updated ResponsiveActions to use child.key instead of child.props.key
  to access React's internal key value without triggering warnings

Co-Authored-By: Claude Sonnet 4.5 <noreply@anthropic.com>
@patternfly-build
Copy link
Copy Markdown

patternfly-build commented Mar 27, 2026

@nicolethoen nicolethoen merged commit 3a62131 into patternfly:main Mar 27, 2026
6 checks passed
@github-actions
Copy link
Copy Markdown

🎉 This PR is included in version 6.4.0-prerelease.16 🎉

The release is available on:

Your semantic-release bot 📦🚀

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.

ResponsiveAction: Warning about accessing 'key' prop

3 participants