File size: 393 Bytes
f5071ca
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
import { useState } from "react";

function useDisplayToggle(initValue) {
	const [display, setDisplay] = useState(initValue);

	const DisplaySetNone = () => {
		if (display === "flex") {
			setDisplay("none");
		}
	};
	const DisplaySetFlex = () => {
		if (display === "none") {
			setDisplay("flex");
		}
	};

	return [display, DisplaySetNone, DisplaySetFlex];
}

export { useDisplayToggle };