모달을 이용하여 경고창 만들기

박찬미·2021년 11월 16일
0

https://ant.design/components/modal/ 을 이용한다.

실습 코드

import { Modal } from "antd";

export default function ModelAlertPage() {
  function onClickSuccess() {
    Modal.success({ content: "게시물 등록에 성공했습니다!!" });
  }
  function onClickFail() {
    Modal.error({ content: "게시물 등록에 실패했습니다!!" });
  }
  return (
    <>
      <button onClick={onClickSuccess}>
        알림창 나타나기!!(성공했을때 메세지)
      </button>
      <button onClick={onClickFail}>
        알림창 나타나기!!(실패했을때 메세지)
      </button>
    </>
  );
}

아래의 사진을 보면 잘 적용되는 것을 볼 수 있다!

profile
우당탕탕

0개의 댓글