This repository contains two independent React exercises bundled inside the same app.
yarn
# Start project
yarn dev
# Run tests
yarn test- Exercise 1 (Slide Viewer): http://localhost:5173/
- Exercise 2 (RPSLS Game): http://localhost:5173/exercice-2
A responsive slide viewer where each slide can have a custom question attached. It features intuitive navigation, a sidebar with thumbnails, and persistent storage via localStorage.
- View slides imported from assets
- Add and edit a custom question per slide
- Navigation with Previous / Next buttons
- Thumbnail sidebar for quick access
- LocalStorage persistence
- Styled with TailwindCSS + Lucide icons
Slides are imported statically and stored in an array:
const slides = [slide1, slide2, slide3];Each slide is rendered with an input box to enter a question, which is saved automatically per slide index.
A real-time multiplayer game where two users are automatically matched in a room to play RPSLS using WebSocket communication.
- Frontend: React + Context API + TailwindCSS
- Backend: Node.js + Express + Socket.io
- Realtime: Socket-based rooms, 1v1 matchmaking
- Persistence: Score is handled in memory per session
- When a user connects and emits
join:- If no one is waiting, they become the
waitingPlayer. - If someone is waiting, a room is created for both users.
- If no one is waiting, they become the
- Room is uniquely named using their socket IDs.
room-readyis emitted to both players.waitingPlayeris cleared until a new user connects.
Player 1 ➜ waiting
Player 2 ➜ paired → room created
Player 3 ➜ waiting
Player 4 ➜ paired → second room created
- Client connects and emits
join. - When
room-readyis received, both players can choose a move. - Each emits
player-choicewhen ready. - When both have submitted:
- The server uses RPSLS rules to determine a winner.
- Scores are updated.
show-resultis emitted to update both players.
new-roundresets choices and emitsroom-readyagain.
joinplayer-choicenew-round
room-readyshow-result- (Optional:
room-closedon disconnect)
- If a
waitingPlayerdisconnects → reset - If a player in a room disconnects → delete room (optional)
- You can promote the remaining player to
waitingPlayer(optional)