Rename internal forwardedRef usage #1553
Merged
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
This addresses issue #1552, where if a parent passes in a
forwardedRef
prop to a connected component (with default options), the connected child will not receive this prop. This change has the same issue with the propreactReduxForwardedRef
, butforwardedRef
is a prop name commonly used and provided in React's documentation, soreactReduxForwardedRef
is much less likely to be used elsewhere.I'm happy to choose a name other than
reactReduxForwardedRef
if there are any suggestions, I went with something that would hopefully be clear that it is for internal use only and would be unlikely to be used by any other codebase.A bit of context for why I'm proposing this change, if it helps. I migrated a large codebase from
react-redux
v5 to v7 recently. This codebase had a lot of instances of refs being passed down as aforwardedRef
prop (per the suggestion in React's documentation). Many of our components are connected components in order to access feature flags. The upgrade broke all cases where aforwardedRef
prop was passed through a connected component. I fixed this in the codebase by renaming all of these propsrefToForward
and making a lint rule to forbid the use offorwardedRef
. This was a little silly, but was a high confidence way to resolve the issue. I believeconnect
swallowingforwardedRef
props is a very minor pain point and can cause confusion for developers, and since the fix isn't too involved I'm of the opinion it's worth doing.It's your all's library though, and I understand if you don't want to merge this. Thanks for all the you do!