React
Fondamental
Conditional rendering based on state
Type d'évaluation
Mise en situation réelle
Analyse
Intelligence Artificielle
Compétences ciblées
react
conditional-rendering
usestate
ternary
jsx
Scénario Technique
Context A UI component must display different content depending on whether a user is logged in. The Problem The team is duplicating entire component trees and toggling CSS classes via JavaScript, rather than using React's conditional rendering patterns. Constraints Use a boolean state variable isLoggedIn. Render a welcome message when true, and a login prompt when false. Toggle the state with a button click. Expected Deliverable A React component demonstrating conditional rendering using a ternary operator or short-circuit evaluation based on a state variable.
Prêt à évaluer ce talent ?
Accédez à l'interface de test complète pour soumettre votre architecture ou votre code.