- Text Content Generator - http://www.lipsum.com
- Favicon Generator - http://tools.dynamicdrive.com/favicon
- Data Generator - https://mockaroo.com/
- Mobile Mockup Generator - https://mockuphone.com
- Logo Generator - https://www.logaster.com
- UUID Generator - https://www.uuidgenerator.net/
- Hash Generator - https://passwordsgenerator.net/sha256-hash-generator/
- Ultimate Code Generator - https://webcode.tools/
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
import { useEffect, useRef } from 'react'; | |
import { useHistory } from 'react-router-dom'; | |
export const usePrompt = (when: boolean, message: string = 'Are you sure you want to quit without saving your changes?') => { | |
const history = useHistory(); | |
const self = useRef(null); | |
const onWindowOrTabClose = event => { | |
if (!when) { |
It assumes the highest positive signed 32-bit float value for numbers.
In other words, 2147483647
(or 0x7FFFFFFF
or 2^31-1
).