R
R
Roman Aleksandrovich2018-07-24 11:24:33
React
Roman Aleksandrovich, 2018-07-24 11:24:33

How to call a method in a child component by ref if connect is registered in child?

Good afternoon. I know that you can call a method in child by ref from the parent component if connect redux is not registered. But here's how to call the method if connect is registered? I tried to output the ref to the console and look at its methods and I did not find my function.

Answer the question

In order to leave comments, you need to log in

2 answer(s)
A
Anton Spirin, 2018-07-24
@RomReed

You can pass the withRef option to connect :
You need to get the ref of the component passed to connect like this: where someRefName is the ref received from connect . getWrappedInstance will only be callable if you pass the withRef option .

M
Mikhail Osher, 2018-07-24
@miraage

RTFM

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question