Hi i want to redirect user to "/home" after load() request completes. but how do i redirect the user to "/home" only if he is not currently in "/home" url.
below is my code,
function useAnother(Id: string) {
    const [compId, setCompId] = React.useState(undefined);
    const {setIsLoading} = React.useContext(LoadingContext);
    const comp = useCurrentComp(Id);
    const load = useLoad();
    if (comp && comp.id !== compId) {
        setCompId(comp.id);
        const prevCompId = compId !== undefined;
        if (prevCompId) {
            setIsLoading(true);
            load().then(() => {// how do i check here if user is already in "/home"  //url and then only redirect him to /home 
                history.push("/home"); 
            });
        }
    }
}
could someone help me with this. thanks.
 
     
    