chore: remove redundant state (#38208)

Co-authored-by: xingming <xingjiang.gxj@antgroup.com>
This commit is contained in:
行冥 2022-10-25 23:24:18 +08:00 committed by GitHub
parent ca97b05661
commit 3390290c26
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -24,7 +24,6 @@ type RangeValue = [Moment | null, Moment | null] | null;
const App: React.FC = () => {
const [dates, setDates] = useState<RangeValue>(null);
const [hackValue, setHackValue] = useState<RangeValue>(null);
const [value, setValue] = useState<RangeValue>(null);
const disabledDate = (current: Moment) => {
@ -38,16 +37,15 @@ const App: React.FC = () => {
const onOpenChange = (open: boolean) => {
if (open) {
setHackValue([null, null]);
setDates([null, null]);
} else {
setHackValue(null);
setDates(null);
}
};
return (
<RangePicker
value={hackValue || value}
value={dates || value}
disabledDate={disabledDate}
onCalendarChange={val => setDates(val)}
onChange={val => setValue(val)}