import React from 'react'; import { Checkbox, Wizard, WizardStep } from '@breakaway/preact-core'; interface SomeContextProps { isToggleStepChecked: boolean; setIsToggleStepChecked(isHidden: boolean): void; } type SomeContextRenderProps = Pick; interface SomeContextProviderProps { children: (context: SomeContextRenderProps) => React.ReactElement; } const SomeContext: React.Context = React.createContext({} as SomeContextProps); const SomeContextProvider: React.FunctionComponent = ({ children }) => { const [isToggleStepChecked, setIsToggleStepChecked] = React.useState(false); return ( {children({ isToggleStepChecked })} ); }; const StepContentWithAction: React.FunctionComponent = () => { const { isToggleStepChecked, setIsToggleStepChecked } = React.useContext(SomeContext); return ( setIsToggleStepChecked(checked)} id="toggle-hide-step-checkbox" name="Toggle Hide Step Checkbox" /> ); }; export const WizardToggleStepVisibility: React.FunctionComponent = () => ( {({ isToggleStepChecked }) => ( Step 2 content Review step content )} );