import { useState, useEffect } from 'react' import CommonApi from '../../../utils/apis/CommonApi'; import { Select, Space } from 'antd'; import _ from 'lodash'; export default function ZoneSelector(props) { const { value, onChange } = props; const [firstDatas, setFirstDatas] = useState([]); const [firstValue, setFirstValue] = useState("-1"); const [secDatas, setSecDatas] = useState([]); const [secValue, setSecValue] = useState("-1"); useEffect(() => { CommonApi.area().then(resp => { setFirstDatas(resp.data); }) }, []) useEffect(() => { if (firstValue) { CommonApi.area(firstValue).then(resp => { setSecDatas(resp.data); }) } else { setSecDatas([]); } }, [firstValue]) return {firstValue !== "-1" && } ; }