The CSS being mostly provided felt like a gift until I realized the actual gotcha was the JSON shape.
Start by outlining the data fetching strategy, including error handling and loading states, then describe how to structure the flexbox grid to match the mockup. Finally, explain the price formatting approach using Intl.NumberFormat with appropriate locale and currency options.
Pro tip: Mention that you would use Intl.NumberFormat for price formatting to ensure correct localization and thousands separators, and discuss how to handle edge cases like missing data or API failures gracefully.
Use fetch or axios to retrieve product data from the mock API, and manage loading and error states with React state or a data fetching library like React Query.
Analyze the mockup to determine the grid structure, then implement a responsive flexbox layout using CSS Flexbox properties like flex-wrap, justify-content, and align-items.
Use the Intl.NumberFormat API with the appropriate locale and currency options to format prices with currency symbol, decimal places, and thousands separators.
Map over the product data to render each item in the grid, and handle edge cases such as missing prices, empty data, or API errors with fallback UI.
AI-generated suggestions, not part of the candidate's original notes. May be inaccurate — verify before relying on them.