我有一个如下所示的组件
interface JoPanelViewProps {
joSelection?: number;
}
interface JourneyPanelViewState {
dateInput?: string;
jos?: Array<JoModel>;
}
function mapStateToProps(state: TStoreState, ownProps: JoPanelViewProps): JoPanelViewProps {
const { joSelection } = state;
return { joSelection };
}
@connect(mapStateToProps, null, null, { pure: true })
class JoPanelView extends React.Component<JoPanelViewProps, JoPanelViewState>{
private jos: JoModel;
constructor(props: JoPanelViewProps, context?: any) {
super(props, context);
this.state = {
dateInput: moment().format('DD/MM/YYYY')
}
this.fetchJos(this.props.joSelection);
}
private fetchJos(joId:number):void{
// updates jos to state to trigger render
}
}
如何使用静态成员函数将joId更新为此类外部的组件属性?或者我有办法吗?