ant-design/components/segmented/demo/controlled-two.md
vagusX 22c10212b6
docs: add debug demo for segmented (#35176)
* docs: add debug demo for segmented

* chore: update

* chore: update
2022-04-23 16:52:48 +08:00

715 B

order title debug
99
zh-CN en-US
受控同步模式 Controlled Synced mode
true

zh-CN

测试受控模式下两个 Segmented 同步 state。

en-US

Tests two Segmented synchronized states in controlled mode.

import { useState } from 'react';
import { Segmented } from 'antd';

const Demo = () => {
  const [foo, setFoo] = useState('AND');
  return (
    <>
      <Segmented
        value={foo}
        options={['AND', 'OR', 'NOT']}
        onChange={e => setFoo(e.target.value)}
      />
      &nbsp;&nbsp;
      <Segmented
        value={foo}
        options={['AND', 'OR', 'NOT']}
        onChange={e => setFoo(e.target.value)}
      />
    </>
  );
};

export default Demo;