Pergunta de entrevista da empresa Microsoft

Given React code, implement proper error handling and idle state