Input
User clicks the button once onSave resolves after 200ms
Output
"Saving..." during the promise, then "Saved" for 1000ms, then "Save"
Implement a save button in React + TypeScript. You are given a prop `onSave(): Promise<void>`. Render a button with `data-testid="save-button"`. Initial state: text is "Save", button is enabled. On click: call `onSave`...
App.tsxEditable starterUser clicks the button once onSave resolves after 200ms
"Saving..." during the promise, then "Saved" for 1000ms, then "Save"
How would you display an error state if onSave rejects?