Allows us to easily handle props as default state in hooks.

Parameters:
NameTypeDescription
defaultValueany

The default value for the useState call.

Since
  • 1.2.13
Returns:

The state value and setter.

Type: 
*
Example
import { useStateWithDep } from '@gravityforms/react-utils';

const Dialog = ( {
	isOpen = false,
	otherProps
} ) => {
     const [ dialogActive, setDialogActive ] = useStateWithDep( isOpen );
};