[Solved] ref not working with React Redux connect

When you are working with the React Redux connect() function you may face an issue to use the ref in the React component. So in this short article, we’ll show you how to access ref in class based component.

Solution

Here we want to clarify that this solution is useful for the class based component. So let’s assume that MyComponent is a class based component and we are using the react-redux in this component.

You can check the options for the connect() method in redux. You need to set forwardRef: true to access ref in a class based component.

I hope you find this article helpful.
Thank you for reading. Happy Coding..!! 🙂

If you found value in this article,
you can support us by buying me a coffee! ☕

You may also like...

Leave a Reply

Your email address will not be published. Required fields are marked *