Search
 
SCRIPT & CODE EXAMPLE
 
CODE EXAMPLE FOR JAVASCRIPT

chrome back button click event react

const {history} = useRouter();
  useEffect(() => {
    return () => {
      // && history.location.pathname === "any specific path")
      if (history.action === "POP") {
        history.replace(history.location.pathname, /* the new state */);
      }
    };
  }, [history])
Source by stackoverflow.com #
 
PREVIOUS NEXT
Tagged: #chrome #button #click #event #react
ADD COMMENT
Topic
Name
3+8 =