refactor: modals
This commit is contained in:
@@ -0,0 +1,17 @@
|
||||
import { useState } from 'react'
|
||||
|
||||
const useToggle = () => {
|
||||
const [active, setActive] = useState<boolean>(false);
|
||||
|
||||
const onToggle = (e?: React.MouseEvent | null) => {
|
||||
if (e) {
|
||||
e.preventDefault();
|
||||
e.stopPropagation();
|
||||
}
|
||||
setActive((prev) => !prev);
|
||||
}
|
||||
|
||||
return { active, onToggle }
|
||||
}
|
||||
|
||||
export default useToggle
|
||||
Reference in New Issue
Block a user