import { Avatar, Button, Space } from 'antd'; import React, { useState } from 'react'; type SizeType = 'large' | 'small' | 'default' | number; const App: React.FC = () => { const [hide, setHide] = useState(true); const [size, setSize] = useState('large'); const [scale, setScale] = useState(1); const toggle = () => { setHide(!hide); }; const toggleSize = () => { const sizes = ['small', 'default', 'large'] as SizeType[]; let current = sizes.indexOf(size) + 1; if (current > 2) { current = 0; } setSize(sizes[current]); }; const changeScale = () => { setScale(scale === 1 ? 2 : 1); }; return ( <>
Avatar Invalid
Avatar Invalid
); }; export default App;