-
-
Notifications
You must be signed in to change notification settings - Fork 3.3k
Open
Description
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
Metadata
Metadata
Assignees
Labels
No labels