react prevent back
const preventBack = (): void => {
window.history.pushState(null, "", window.location.pathname);
}
const handleBack = (): void => {
console.log('handleBack')
}
useEffect(() => {
preventBack();
window.addEventListener('popstate', handleBack);
return () => {
window.removeEventListener('popstate', handleBack)
}
});
Also in JavaScript:
- ad data to js object
- how to make a component reload in angular
- laravel return response json
- class component react
- localstorage javascript
- email regex
- how to rerender a page in React when the user clicks the back button
- stopper un intervalle javascript
- new file shortcut vscode
- reactjs app change port
- js pixelated
- Converting from HttpClient to Native HTTP
- how to print in java script
- ssr in angular 9 example
- javascript sanitize input slug
- how to print the value of variable in javascript in html
- catch statement javascript
- how to create tab component in jquery
- how to set text for label in jquery
- regular expression to validate m/d/yyyy HH:MM:SS AM
- node list files in directory
- Object as a Function
- jquery preload images
- array.filter in javascript