Skip to content

External property ref is always overridden with value undefined #2251

Closed

Description

@PSpSynedra

What version of React, ReactDOM/React Native, Redux, and React Redux are you using?

  • React: 19.1.1
  • Redux: 5.0.1
  • React Redux: 9.2.0

What is the current behavior?

Whe wrapping a component with connect without passing the option forwardRef set to true, the wrapped component always receives a prop ref with value undefined overriding any other prop named ref:

function WrappedComponent(props) {
   const {ref} = props
   // ref will always be undefined  when wrapped within connect like below.
   return <pan ref={ref} />
}

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)

What is the expected behavior?

A passed property ref is passed to the wrapped component, when the option fowardRef is not present or falsy.

Which browser and OS are affected by this issue?

No response

Did this work in previous versions of React Redux?

  • Yes

Activity

  1. PSpSynedra commented on Aug 26, 2025

    @PSpSynedra
    ContributorAuthor

    Unfortunately I cannot get the "Test Published Artifact expo (pull_request)" to pass for the pull request #2252.
    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?

    It seems that this is a general problem as pull request #2246 seems to suffer from the same problem.

  2. added theissue type on Mar 18, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions