{"version":"1.0","type":"rich","title":"Hook that toggles a boolean state.","description":"This example demonstrates a React hook that manages a boolean state and provides a toggle function. It shows how to initialize the state with a default value and update it based on an optional argument. The code uses `useState` to hold the boolean and `useCallback` to memoize the toggle callback, which flips the previous state unless a boolean value is explicitly passed. The hook returns the current state and the callback as a tuple, enabling flexible state control in components.","provider_name":"VizHub AI Studio","provider_url":"https://next.vizhub.com","html":"<iframe src=\"https://next.vizhub.com/viz/gist-3d7577f642feb6b6b3910d2f66ef0253?mode=embed\" width=\"960\" height=\"500\" scrolling=\"no\" frameborder=\"1\"></iframe>","width":960,"height":500,"cache_age":3600}