結果 - 入選下一輪
開發一個簡單的 React 應用程序,透過路由和動態資料獲取來顯示城市和產品銷售資訊。該應用程式應該允許用戶在不同頁面之間導航,並且應該追蹤訪問過多少個城市和產品。數據應根據用戶請求刷新。
應用概述:
首頁:
API 端點:
城市詳細資料頁面:
產品詳情頁:
刷新按鈕:
帶路由的單頁應用程式 (SPA):
評估標準:
城市 API 回應:
{ "status": "success", "data": [ "Bombay", "Bangalore", "Pune", "Kolkata", "Chennai", "New Delhi" ] }
描述:此 API 傳回可用銷售資料的城市名稱清單。資料數組包含這些城市的名稱。
特定城市的銷售數據:
{ "status": "success", "data": { "product1": 137, "product2": 23, "product3": 77 } }
Description: This API returns sales data for a specific city. The data object contains key-value pairs where the key is the product name and the value is the number of items sold in that city.
Products List API Response:
{ "status": "success", "data": { "product1": 137, "product2": 23, "product3": 77 } }
Description: This API returns a list of all products with their total sales figures. The data object contains key-value pairs where the key is the product name and the value is the total number of items sold across all cities.
Product Detail API Response:
{ "status": "success", "data": { "product1": 137, "product2": 23, "product3": 77 } }
Description: This API returns the sales data for a specific product across different cities. The data object contains key-value pairs where the key is the city name and the value is the number of items sold for that product in that city.
Please ensure that you fully understand the requirements before starting the implementation. There’s a minor issue with the API response for the product/a2146e9d12dacc62f0ab03879c7fd44b endpoint, but it can be worked around with the provided data. Adding the API responses for reference above.
You are encouraged to implement the solution and make any necessary modifications to the APIs as needed to meet the requirements. If you need more details or are interested in similar assignments, you can refer to my E-Commerce Project.
以上是React 編碼挑戰 - 使用 React 的城市/產品銷售瀏覽器的詳細內容。更多資訊請關注PHP中文網其他相關文章!