Explore Library
Code QuizBeginner

Switch Toggle

Learn the correct callback prop for the Switch component.

Codejavascript
import React, { useState } from 'react';
import { Switch } from 'react-native';

export default function Toggle() {
  const [on, setOn] = useState(false);
  return (
    <Switch value={on} onChange={setOn} />
  );
}

What is the bug in this code?