Easy
In a React application for managing user preferences, what will happen when the user clicks the toggle button?"
1function PreferencesManager() {2 const [settings, setSettings] = useState({3 notifications: true,4 theme: 'light'5 });67 const toggleNotifications = () => {8 setSettings({9 notifications: !settings.notifications10 });11 };1213 return (14 <div>15 <h2>User Preferences</h2>16 <p>Theme: {settings.theme}</p>17 <p>Notifications: {settings.notifications ? 'On' : 'Off'}</p>18 <button onClick={toggleNotifications}>Toggle Notifications</button>19 </div>20 );21}