Novo curso: Como conseguir vagas remotas em empresas que pagam $120k+/ano
NaGringa
CodingSenior

Create a song player React component

I had 45m to implement this component. This is a classic React Context + state management exercise — a music player with song selection, next/previous navigation, and replay modes. Let me break down what you need to implement and then give you the solution. What the task is asking: You have two components (ControlBar and Songs) that share state via Context. You need to: 1. Track the current song — clicking a Song makes it active (green title, active={true} on SongTitle). 2. Display current song in ControlBar — format: ${author} - ${songTitle}, empty string if none selected. 3. Replay mode cycling — button cycles: Not replaying → Replaying all → Replaying one → Not replaying → ... 4. Next/Previous with mode-aware logic: - Not replaying: Previous at start = stays same; Next at end = no song selected - Replaying all: Previous at start = last song; Next at end = first song (wraps) - Replaying one: Next and Previous both keep the current song 5. Previous/Next without a mode — changes song to adjacent, or wraps/stops based on mode 6. usePlayerContext error — throw if used outside PlayerProvider

Empresas em que apareceu
ProxifyProxify
Contextos reais

Onde essa pergunta já apareceu

Use esses exemplos para entender em que contexto ela costuma cair e adaptar sua prática.

Proxifyseniormar. de 2026

Sem observação adicional neste relato público.

Anexos públicos

Materiais associados

Nenhum anexo público associado a esta pergunta.

Próximo passo

Depois de treinar essa pergunta, vale abrir outras do mesmo tipo e da mesma senioridade para comparar padrões de resposta.

Isso ajuda a sair da memorização de uma resposta só e entrar em repertório real de entrevista.

Continue a preparação com o banco completo

No app você encontra perguntas parecidas, compara empresas e aprofunda essa busca com mais filtros.