steveruizok
4/30/2019 - 9:35 AM

Switch Tutorial - In React

Switch Tutorial - In React

export function ParentFrame() {
	const [state, setState] = React.useState({
		mode: "day",
	})

	const handleSwitchFlip = () => {
		setState({
			mode: "night",
		})
	}

	return (
		<Frame>
            <Switch 
                isOn={state.mode === "night"} 
                onValueChange={handleSwitchFlip} />
		</Frame>
	)
}