0% ont trouvé ce document utile (0 vote)
27 vues4 pages

Examen React JS : Développement d'une App

L'examen porte sur le développement d'une application web pour un club de sport utilisant React JS 18. Les étudiants doivent créer des composants pour gérer les compétitions, l'affichage des détails, et intégrer une fonctionnalité de participation avec Redux Toolkit. L'examen est divisé en deux parties, chacune évaluée sur 10 points, avec des consignes spécifiques pour chaque composant à développer.

Transféré par

samsouma.sms
Copyright
© All Rights Reserved
Nous prenons très au sérieux les droits relatifs au contenu. Si vous pensez qu’il s’agit de votre contenu, signalez une atteinte au droit d’auteur ici.
Formats disponibles
Téléchargez aux formats PDF, TXT ou lisez en ligne sur Scribd
0% ont trouvé ce document utile (0 vote)
27 vues4 pages

Examen React JS : Développement d'une App

L'examen porte sur le développement d'une application web pour un club de sport utilisant React JS 18. Les étudiants doivent créer des composants pour gérer les compétitions, l'affichage des détails, et intégrer une fonctionnalité de participation avec Redux Toolkit. L'examen est divisé en deux parties, chacune évaluée sur 10 points, avec des consignes spécifiques pour chaque composant à développer.

Transféré par

samsouma.sms
Copyright
© All Rights Reserved
Nous prenons très au sérieux les droits relatifs au contenu. Si vous pensez qu’il s’agit de votre contenu, signalez une atteinte au droit d’auteur ici.
Formats disponibles
Téléchargez aux formats PDF, TXT ou lisez en ligne sur Scribd

EXAMEN

Semestre : 1 2
Session : Principale Rattrapage

Module : Application Côté Client 2


Enseignants : UP Web
Classes : 4TWIN
Documents autorisés : OUI NON Nombre de pages : 4
Calculatrice autorisée : OUI NON Internet autorisée : OUI NON
Date : 13/06/2023 Heure : 11h:00 Durée : 01h30

NB : seul le code exécutable sera pris en considération lors


de la correction
Toute carte wifi active est une tentative de fraude.

Étude de cas : (20 pts)

Un club de sport envisage de créer un site web CompetitionWorld qui permettra


aux utilisateurs de consulter les compétitions programmées par le président du club.
L'application permettra également aux utilisateurs de consulter les détails des compétitions
et de participer. Pour réaliser ce projet, vous utiliserez la bibliothèque React JS 18. Afin de
développer cette application, vous devrez respecter les consignes ci-dessous :
● L’utilisation de react-bootstrap et bootstrap est facultative.
● Respecter l’arborescence des composants suivante :

Figure 1: Arborescence des composants

Sachant que :
- Tous les composants sont des composants fonctionnels sauf le composant Home est un
composant de Classe.
1
Travail à faire :

Partie A (10 pts ):


Soit le fichier [Link] à créer sous le dossier src contenant le code suivant :
[
{
"id": "1",
"name": "Hackathon",
"fees": "100",
"date": "01/04/2023",
"participants": 10,
"description": "Lorem ipsum dolor sit amet, consectetur adipisicing elit. Vitae consectetur earum
distinctio culpa voluptatum eum ad laboriosam qui, dolore repudiandae cupiditate rerum optio eius.
Doloribus numquam velit veritatis quisquam magnam."
},
{
"id": "2",
"name": "Meet & Greet",
"fees": "30",
"date": "01/04/2023",
"participants": 0,
"description": "Lorem ipsum dolor sit amet, consectetur adipisicing elit. Vitae consectetur earum
distinctio culpa voluptatum eum ad laboriosam qui, dolore repudiandae cupiditate rerum optio eius.
Doloribus numquam velit veritatis quisquam magnam."
},
]

Figure 2: Contenu du fichier [Link]

1) Créer les composants Competitions et Competition afin d’afficher les informations des
compétitions en intégrant le contenu du fichier json. (3 pts)

Figure 3: Affichage des compétitions

2) Créer le composant de classe Home en respectant les consignes suivantes : (1 pt)


 Un message sera affiché « Welcome to Our Competition World ».
 Le message va disparaître après 3 secondes.

3) Créer le composant NavigationBar comme le montre la figure 4 en configurant les routes


nécessaires : (1.5 pts)
 La route active dans la NavigationBar doit être soulignée.

2
Figure 4: Barre de navigation

4) Créer le composant NotFound qui sera affiché si l’utilisateur accède à une route qui n’existe pas.
Un message d’erreur « This page does not exist » doit être affiché. Ce message disparaît après 3
secondes. (1.5 pts)
5) Créer la nouvelle interface du composant CompetitionDetails qui affiche les détails d'une
compétition. Cette interface sera affichée en cliquant sur le lien « Details » dans la liste des
compétitions. Si le nombre de participants est égal à 0, le bouton « Participate » sera désactivé.
(3 pts)

Figure 5: Contenu de l'interface du détail d'une compétition

3
Partie B (10 pts):
Dans cette partie, nous souhaitons intégrer la fonctionnalité de participer à une compétition bien
déterminée en utilisant Redux Toolkit. Ajouter cette fonctionnalité en respectant les consignes suivantes :

1) Lorsqu'un utilisateur clique sur le bouton « Participate », un formulaire sera affiché


comme le montre la figure suivante. Ce dernier sera développé dans un nouveau
composant appelé AddPlayer. (3 pts)

Figure 6: Formulaire d'ajout d'un participant

2) L’utilisateur remplit le formulaire, si le nom d’utilisateur « username » existe déjà dans


la liste des participants, il ne sera pas ajouté à nouveau. (2.5 pts)
3) Si le participant a été ajouté, le nombre de participants sera décrémenté. (1.5 pts)
4) La liste des participants sera affichée sous les détails de la compétition dans le composant
CompetitionDetails et le composant AddPlayer disparaît. (3 pts)
NB : Si la liste des participants est vide, elle ne sera pas affichée.

Figure 7: Affichage liste des participants

Bon courage 
4

Common questions

Alimenté par l’IA

Decrementing the number of participants upon new registration reflects the dynamic updates within the application, ensuring the system shows accurate real-time data . This can be implemented by integrating Redux Toolkit, where an action is dispatched to update the state when a participant is added. Using Redux state allows the CompetitionDetails component to re-render with the new participant count, ensuring all components reflect the current state accurately.

Prohibiting active wifi cards during an exam strengthens the integrity of the examination by mitigating opportunities for unauthorized access to external resources, which prevents cheating through internet searches or unauthorized collaboration . This rule reinforces fairness and consistency. However, it could limit certain potential resources for students if there are online components integral to the test setup, requiring alternative means to integrate these elements securely into the examination process.

Ensuring a seamless display of the 'NotFound' component involves improving user experience through clear communication and minimizing confusion by offering a prompt navigation option or redirect . Implementing a countdown for the error message that also automatically redirects users to a relevant section, like the home page or navigation options, can create an efficient recovery path, preventing frustration from error occurrences. Additionally, incorporating a reload prevention state ensures continuity when users navigate away and back to nonexistent routes.

Focusing only on executable code in evaluation emphasizes the functionality of the students' code and its ability to meet project requirements . This promotes practical skills over mere theoretical knowledge. However, it may overlook good coding practices such as readability, maintainability, and documentation, potentially fostering habits that prioritize working code over well-structured code. Balancing between execution and code quality can offer a more holistic assessment of students' capabilities and encourage all-rounded skill development.

The navigation design in the web application enhances user experience by providing a clear and structured path for accessing different parts of the application through the 'NavigationBar' component . Highlighting the active route improves usability by indicating the current location . However, the effectiveness could be limited if the navigation does not adapt to different screen sizes, leading to poor user experience on mobile devices. Additionally, clear labeling and intuitive grouping of navigation links would further improve accessibility.

The AddPlayer component serves a pivotal role in the integration of React and Redux by acting as the interface for adding participants to a competition . It opens a form for users to submit registration details and dispatches actions to Redux, verifying uniqueness of the username and managing state changes. This component contributes to application functionality by encapsulating user input logic and ensuring changes are propagated throughout the application via Redux, maintaining the integrity of shared state and updating connected components efficiently.

In a React application for displaying sports competitions, functional components can be used to handle presentational logic and rendering UI elements, such as listing competitions from a JSON file . These components are lightweight and allow for the easy implementation of hooks for managing state and lifecycle methods. On the other hand, a class component like 'Home' can handle more complex logic, such as displaying a welcome message that disappears after a specific time using lifecycle methods like componentDidMount to set a timer . Thus, functional components contribute to modularity and simplification of the codebase, while class components manage complex behaviors and state management effectively.

Using Redux Toolkit for managing participant registration provides several benefits. It simplifies state management with pre-configured functions and a standardized setup, which reduces boilerplate code and enhances the maintainability of the application. Redux's centralized state management ensures consistency across components and simplifies debugging . However, drawbacks include added complexity for small applications and the learning curve associated with understanding the Redux lifecycle and middleware. Additionally, integrating Redux can increase the bundle size and may be unnecessary if the component state can be effectively managed with React's Context API.

Implementing efficient component lifecycle and state management in a dynamic web application requires leveraging React hooks such as useEffect for side effects and context or Redux for state management to maintain consistency across components. Utilizing memoization (with useMemo and React.memo) prevents unnecessary re-renders for improved performance . Asynchronous state updates can be managed using middleware like Redux Thunk or logic through hooks that ensure UI responsiveness and data consistency. Additionally, adopting a modular architecture with well-defined state hierarchies promotes clear state flow and updates, allowing each component to respond optimally to lifecycle events and changes.

Disabling the 'Participate' button when participants count is zero might cause confusion among users who have no prior indication of why they cannot interact with it . This issue can be addressed by providing feedback such as a tooltip or a message explaining that no spots are available, thus enhancing clarity. Additionally, a change in visual indication, like graying out the button along with the explanatory text, can help manage user expectations and improve usability.

Vous aimerez peut-être aussi