im trying to trigger a child component's method here. I have the following components :
Child component
class WorkflowIllustration extends Component {
  _unselectEdge(previous_transition) {
      /// some code///
  }
    render() {
        return (
          <Fragment>
            ///some code//
        </Fragment>
        )
    }
}
//some redux code here//
export default withResizeDetector(connect(null, mapDispatchToProps)(WorkflowIllustration));
parent component
class WorkflowObjectComponent extends Component {
  constructor(props) {
    super(props);
    this.WorkflowIllustration = React.createRef();
  }
  state = { visible: false };
  componentDidMount() {
    this.props.initial(this.props.workflow_class.id,this.props.match.params.id)
  }
  showDrawer = () => {
    this.setState({
      visible: true,
    });
  };
  
  onClose = () => {
    this.setState({
      visible: false,
    })
    console.log(this.refs)
    this.WorkflowIllustration.current._unselectEdge(this.props.workflowobject.selected_transition)
    console.log(this.WorkflowIllustration)
  };
  render() {
    return (
        <Fragment>
            <Col className="gutter-row" span={12}>
              <WorkflowIllustration
                can_edit={false}
                workflow={this.props.workflowobject}
                showDrawer={this.showDrawer}
                ref={this.WorkflowIllustration}
              />
            </Col>
          <Drawer
            title="Change Password"
            placement="right"
            closable={true}
            onClose={this.onClose}
            visible={this.state.visible}
            width={600}
          >
              <WorkflowEditor
                can_edit={false}
                workflow={this.props.workflowobject}
              />
          </Drawer>
        </Fragment>
        :
        <div style={{ textAlign: 'center' }}><Spin size='large' /></div>
    )
  }
} 
export default withRouter(connect(mapStateToProps, mapDispatchToProps)(WorkflowObjectComponent));
However in my console im getting this:
{current: null}
followed by an error that they cant read the value of undefined. As much as possible , i would like to adopt this pattern of code as i don't wish to touch the child component.
Is there a reason and a solution to this?
 
    