When to use testutils functions like
to test components and when to use refs?
say we have parent Parent component and inside that is Child child component
const parent = renderIntoDocument( <Parent /> );
Now if we want to select Child child component I think, we have two options-
1. const child = scryRenderedComponentsWithType(parent, 'Child'); const el = ReactDOM.findDOMNode(child); 2. const child = voting.refs.someref; ("Assuming we have a ref element on child component with value") const el = ReactDOM.findDOMNode(child)
My question is when to use first one and when to use second one and how to decide? Because in different situations both are not working same