tessl install tessl/npm-types--react@19.1.0TypeScript definitions for React, the popular JavaScript library for building user interfaces
Agent Success
Agent success rate when using this tile
80%
Improvement
Agent success rate improvement when using this tile compared to baseline
1.48x
Baseline
Agent success rate without this tile
54%
Build a user preferences management system for a React application that efficiently handles user settings and prevents unnecessary component re-renders.
Your system should manage user preferences (theme, language, notifications) and expose both the current preferences state and functions to update them. The implementation must be optimized to minimize re-renders when preferences change.
The preferences should include:
theme: A string value, either "light" or "dark"language: A string value, such as "en", "es", "fr"notifications: A boolean indicating whether notifications are enabledCreate a preferences provider component that:
Provide these functions to update preferences:
updateTheme(theme: string): Updates the theme preferenceupdateLanguage(language: string): Updates the language preferenceupdateNotifications(enabled: boolean): Updates the notifications preferenceImplement the following components:
@generates
export interface Preferences {
theme: string;
language: string;
notifications: boolean;
}
export interface PreferencesActions {
updateTheme: (theme: string) => void;
updateLanguage: (language: string) => void;
updateNotifications: (enabled: boolean) => void;
}
export interface PreferencesProviderProps {
children: React.ReactNode;
}
export const PreferencesProvider: React.FC<PreferencesProviderProps>;
export const ThemeDisplay: React.FC;
export const LanguageSelector: React.FC;
export const PreferencesForm: React.FC;Provides React framework functionality including hooks and context.
Provides TypeScript type definitions for React.