Closed
Description
If the component wrapped with connect
is a stateless function component, React warns about the internal ref that the wrapper holds with the following message Warning: Stateless function components cannot be given refs (See ref "wrappedInstance" in App created by Connect(App)). Attempts to access this ref will fail.
import { connect } from 'react-redux';
import React from 'react';
export default connect(mapStateToProps)(props => <div />);
Would it be useful to check whether the component is stateless or not to decide when to apply the ref or do we always need it?
Metadata
Metadata
Assignees
Labels
No labels