You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
 
 

25 lines
634 B

// InteractiveIranMap.js
import React from "react";
import IranMap from "./IranMap";
const InteractiveIranMap = (props) => {
const [state, setState] = React.useState({ selectedArea: "tehran" });
const selectAreaHandler = (area) => {
let id = area.id.slice(1, 3);
if (id < 32) {
setState((prevState) => ({ ...prevState, selectedArea: area.name }));
props.onChange(id);
} else {
return;
}
};
return (
<div>
<IranMap
onClick={selectAreaHandler}
selectedArea={state.selectedArea}
useTestData={true}
/>
</div>
);
};
export default InteractiveIranMap;