How to call super? after constructor statements

first of all, there is a baseClass

class BaseDialog extends React.Component {
  constructor(props) {
    this.state[this.state.preProp] = "ValueA"; // this.state["KeyA"] = "ValueA"
  }
}

class InstanceDialog extends BaseDialog {
  constructor(props){
    super(props)
    this.state.preProp = "KeyA";
  }
}

because BaseDialog is parent, you can"t get preProp,. Is there any way for BaseDialog to get the preProp value in instance

?
May.05,2021

in design pattern, this is a reverse dependency, which violates the design principle, and the parent component should not rely on the state of the child component. If you really need a child component to pass a value to the parent component, you can pass


no way (impossible)

in props.
Menu