Tab Component with Lazy Loading — Tabbed UI That Defers Rendering of Panel Content Until Tab Becomes Visible
Build a Tab component that renders a set of clickable tab headers and a content panel below. The key variation is lazy loading: the content of each tab panel should only be fetched or rendered when that tab is first clicked — not on initial mount. Once a tab's content has been loaded it should be cached and not re-fetched on subsequent visits to that tab. Implement two approaches: (1) using React Context to share active tab state, (2) using normal state management. Show a Loading... placeholder while content is being fetched. This question was asked in Atlassian's Principal Engineer (P60) interview and Okta's senior frontend interview.