Microsoft interview question

Given React code, implement proper error handling and idle state