getNode method
Returns the DOM node associated with the mounted React composite / DOM component instance.
If you are rendering a function component using mount, calling getNode will throw a
StateError
.
Try using mountNode if it works for your application.
Otherwise, try getting the root using one of the following instead:
queryByTestId(jacket.mountNode, yourRootNodeTestId);
jacket.mountNode.querySelector(someSelectorThatTargetsTheRootNode);
Implementation
Element? getNode() {
if (!_isCompositeComponent && !_isDomComponent) {
throw StateError(over_react.unindent('''
getNode() is only supported when the rendered object is a DOM or composite (class based) component.
If you are rendering a function component:
1. Try using [mountNode] if it works for your application.
2. Otherwise, try getting the root using one of the following instead:
jacket.mountNode.querySelector(someSelectorThatTargetsTheRootNode)
// or
queryByTestId(jacket.mountNode, yourRootNodeTestId)
'''));
}
return over_react.findDomNode(_renderedInstance);
}