这是我的变量所在的构造函数,我只想在 HorizontalLinearStepper 中传递这个变量...
export class Dashboard extends React.Component {
constructor(props) {
super(props);
this.state = {
area: null,
};
}
我成功获取了值并将其设置为 this.state.area
var Area = L.GeometryUtil.geodesicArea(layer.getLatLngs()[0]);
var area1 = L.GeometryUtil.formattedNumber(Area * 0.001) + " m²";
console.log(area1);
this.setState({
area: area1,
});
这就是在第 1 步中我给组件仪表板的方式
case 1:
return (
<div style={{ padding: "2% 0" }}>
<Typography variant="h4">Find your land on the map</Typography>
<AlertNoPoly errorStatusPolly={errorStatusPolly} />
<ul>
<li>
Find your land on the map and mark it using the map tools.
</li>
<li>Or upload a digital file of your land</li>
</ul>
<Dashboard viewMap={viewMap} area={area} />
</div>
);
现在我的问题是,从 stepper 到 Dashboard 传递带有其值的变量没有问题,但是如何从 Dashboard 到 stepper 传递变量?