score:0

useEffect(() => {
    let didCancel = false;

    VocabDataService.getAll()
        .then((response) => {
            if (!didCancel) {
                setVocab(response.data);
            }
        })
        .catch((e) => {
            console.log(e);
        });

    return() => {
        didCancel = true;
    };
});

score:0

if(mounted){
   setVocab(data);
}

Related Query

More Query from same tag