mirror of
https://github.com/ant-design/ant-design.git
synced 2025-06-07 09:26:06 +08:00
chore: remove redundant state (#38208)
Co-authored-by: xingming <xingjiang.gxj@antgroup.com>
This commit is contained in:
parent
ca97b05661
commit
3390290c26
@ -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)}
|
||||
|
Loading…
Reference in New Issue
Block a user