useToggle

UseToggleExample

src/prod/booleans/useToggle.ts

import React from 'react';



export const useToggle = (intialState = false) => {
	const [x, setX] = React.useState(intialState);
	const toggleX = () => setX((x: boolean) => !x);
	return [x, toggleX];
};

dist/prod/booleans/useToggle.js

import React from 'react';
export const useToggle = (intialState = false) => {
    const [x, setX] = React.useState(intialState);
    const toggleX = () => setX((x) => !x);
    return [x, toggleX];
};

src/prod/booleans/useToggle.ts

import React from 'react';



export const useToggle = (intialState = false) => {
	const [x, setX] = React.useState(intialState);
	const toggleX = () => setX((x: boolean) => !x);
	return [x, toggleX];
};