mirror of
https://github.com/ant-design/ant-design.git
synced 2025-06-12 12:23:08 +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 App: React.FC = () => {
|
||||||
const [dates, setDates] = useState<RangeValue>(null);
|
const [dates, setDates] = useState<RangeValue>(null);
|
||||||
const [hackValue, setHackValue] = useState<RangeValue>(null);
|
|
||||||
const [value, setValue] = useState<RangeValue>(null);
|
const [value, setValue] = useState<RangeValue>(null);
|
||||||
|
|
||||||
const disabledDate = (current: Moment) => {
|
const disabledDate = (current: Moment) => {
|
||||||
@ -38,16 +37,15 @@ const App: React.FC = () => {
|
|||||||
|
|
||||||
const onOpenChange = (open: boolean) => {
|
const onOpenChange = (open: boolean) => {
|
||||||
if (open) {
|
if (open) {
|
||||||
setHackValue([null, null]);
|
|
||||||
setDates([null, null]);
|
setDates([null, null]);
|
||||||
} else {
|
} else {
|
||||||
setHackValue(null);
|
setDates(null);
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
return (
|
return (
|
||||||
<RangePicker
|
<RangePicker
|
||||||
value={hackValue || value}
|
value={dates || value}
|
||||||
disabledDate={disabledDate}
|
disabledDate={disabledDate}
|
||||||
onCalendarChange={val => setDates(val)}
|
onCalendarChange={val => setDates(val)}
|
||||||
onChange={val => setValue(val)}
|
onChange={val => setValue(val)}
|
||||||
|
Loading…
Reference in New Issue
Block a user