Skip to content

Conversation

PSpSynedra
Copy link
Contributor

The current behavior of connect is to always pass along a ref property, event when the option forwardRef was not truthy or preset.

This pull request

The error in the following use case is also fixed with this pull-request:

import WrappedComponent from '...'
function HocComponent(props) {
   const [wrapperRef, setRef] = useState(null)
   // The current behavior of connect would override the ref!
   return <WrappedComponent ref={setRef} {...props} />
}
export default connect(...)(HocComponent)

NOTE:
My initial intend was to remove the use of React.forwardRef(...) completely, but this would have broken the compatibility with React prior to version 19.

Copy link

codesandbox-ci bot commented Aug 21, 2025

This pull request is automatically built and testable in CodeSandbox.

To see build info of the built libraries, click here or the icon next to each commit SHA.

@PSpSynedra
Copy link
Contributor Author

PSpSynedra commented Aug 21, 2025

Unfortunately I cannot get the "Test Published Artifact expo (pull_request)" to pass.
When I run yarn install with node-22.18.0 as suggested by some internet search results, my local yarn.lock does not get changed.

Can I run the failing test locally on my machine to fix the issue?
Any suggestions on how to fix this?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

External property ref is always overridden with value undefined
1 participant