Last active
July 17, 2019 11:56
-
-
Save mehmetyilmaz001/9d38122732e8be8a99f5de35eb5e76d0 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
const isInitialMount = useRef(true); | |
const createQuestionRes = useSelector( s => s.dialog.createQuestionRes); | |
useEffect(() => { | |
if(isInitialMount.current){ | |
isInitialMount.current = false; | |
}else{ // Trigger useEffect only on update (no in did mount) | |
if(_.has(createQuestionRes, 'hasError') && !createQuestionRes.hasError){ | |
history.push(getMenuItem('QA').path); | |
} | |
} | |
}, [createQuestionRes]); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment