Nested modals

One modal generating another.

import { useState } from 'react';
import { Modal } from '@citizensadvice/react-dialogs';

export function Example() {
  const [show, setShow] = useState();
  const [showChild, setShowChild] = useState();

  return (
    <>
      <button
        type="button"
        onClick={() => setShow(!show)}
        aria-expanded={show}
        aria-haspopup="dialog"
      >
        Toggle
      </button>
      {show && (
        <Modal title="Modal title" onClose={() => setShow(false)}>
          <p>
            Lorem ipsum dolor sit amet, consectetur adipiscing elit, sed do
            eiusmod tempor incididunt ut labore et dolore magna aliqua.
          </p>
          <p>
            Ut enim ad minim veniam, quis nostrud exercitation ullamco laboris
            nisi ut aliquip ex ea commodo consequat.
          </p>
          <p>
            Duis aute irure dolor in reprehenderit in voluptate velit esse
            cillum dolore eu fugiat nulla pariatur.
          </p>
          <p>
            <button
              type="button"
              onClick={() => setShowChild(!showChild)}
              aria-expanded={showChild}
              aria-haspopup="dialog"
              data-auto-focus
            >
              Toggle
            </button>
          </p>
          {showChild && (
            <Modal title="Child modal" onClose={() => setShowChild(false)}>
              <p>
                Lorem ipsum dolor sit amet, consectetur adipiscing elit, sed do
                eiusmod tempor incididunt ut labore et dolore magna aliqua.
              </p>
            </Modal>
          )}
        </Modal>
      )}
    </>
  );
}