mirror of
https://github.com/ant-design/ant-design.git
synced 2024-12-05 09:49:57 +08:00
23 lines
428 B
TypeScript
23 lines
428 B
TypeScript
|
import React, { useState } from 'react';
|
||
|
import { Button, Switch } from 'antd';
|
||
|
|
||
|
const App: React.FC = () => {
|
||
|
const [disabled, setDisabled] = useState(true);
|
||
|
|
||
|
const toggle = () => {
|
||
|
setDisabled(!disabled);
|
||
|
};
|
||
|
|
||
|
return (
|
||
|
<>
|
||
|
<Switch disabled={disabled} defaultChecked />
|
||
|
<br />
|
||
|
<Button type="primary" onClick={toggle}>
|
||
|
Toggle disabled
|
||
|
</Button>
|
||
|
</>
|
||
|
);
|
||
|
};
|
||
|
|
||
|
export default App;
|