Cannot read property ... from undefined, when conditionally render a component with ref property
By : Sabrina Fonseca
Date : March 29 2020, 07:55 AM
wish help you to fix your issue I believe the problem is because you are using the same click handler onClickRow to both set showDetailDeposito to true, and then use the ref to call a function. However, because setState is asynchronous, the call to the ref fails as that component has not yet been mounted due to showDetailDeposito being false. To fix, you could try using the callback in setState to call the ref function once the state has been set.