score:1

Accepted answer
const App = props => {
  const [open, setOpen] = useState(["1"]);
  const handleSubmit = e => {
    e.preventDefault();
    setOpen([]);
  };
  return (
    <Collapse activeKey={open} onChange={() => setOpen(prev => [1])}>
      <Panel
        onChange={() => setOpen(prev => [1])}
        header="This is panel header 1"
        key="1"
      >
        <p>{text}</p>
        <form onSubmit={handleSubmit}>
          <button type="submit">Submit</button>
        </form>
      </Panel>
    </Collapse>
  );
};

Related Query

More Query from same tag