Replies: 1 comment 4 replies
-
|
We have an answer coming here soon! It will rely on the upcoming Fragment Refs feature coming to React, which avoids a lot of the issues with the |
Beta Was this translation helpful? Give feedback.
4 replies
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Uh oh!
There was an error while loading. Please reload this page.
-
Goals
Non-Goals
No response
Background
The standard API as below is not compatible with component libraries that provide their own
<a>implementations.The alternative
legacyBehaviouris not convenient and is not recommended by the react team.The
cloneElementAPI, whichnext/link’slegacyBehaviourattribute relies on, is a legacy React API method and should not be the main route to support anchor components in component libraries. See: reactjs/react.dev#6057Related discussion: #15560 (comment)
Proposal
The recommended way by React to share functionality is to use hooks: https://react.dev/reference/react/cloneElement#extracting-logic-into-a-custom-hook
Proposed API:
Beta Was this translation helpful? Give feedback.
All reactions