본문 바로가기

React

[React & 가계부프로젝트] nextTick 사용하기

npm i progress
import { nextTick } from 'process';

const handleSubmit = async (e: any) => {
    e.preventDefault();

    if (!checkValidate()) return;

    nextTick(() => {
        //nextTick 위에줄 모두 끝난 후 실행할 구문
        alert('등록이 완료되었습니다.');
    });
};
progess를 다운받고, nextTick을 불러온 다음, 앞에줄이 모두 끝난 후 실행할 구문을 적으면 된다.
반응형