CodeYourFuture / CodeYourFuture/React-Module-Project

Feature fetch bookings

Đang mở
#16 0 bình luận 0 reaction 0 người được giao Xem trên GitHub
🐂 Size Medium 📅 Week 3 🧩 Feature
Ngôn ngữ chính
JavaScript
Star
1
Fork
28
Chỉ số merge pull request
Không có pull request nào được merge trong 30 ngày

Mô tả

### 16. Load bookings remotely

**Instructions:**

Instead of getting the existing bookings from the file `data/fakeBookings.json`, we will get and load the bookings from a remote API. In the `` component, use the React function `useEffect` to `console.log()` some text only when the page first renders on the screen. Verify that when you refresh the page, the text appears once in the console. Then, in the `useEffect` function, use the `fetch()` function to get data from `https://cyf-react.glitch.me`.

Try to pair or mob on this feature.

**Hints:**

- Replace `FakeBookings` in the bookings state and initialise it with `[]` (because we haven't fetched any results yet!)
- After calling the `fetch()` function, use `.then()` to handle the response. Try looking at your Pokemon app that you worked on in class for an example
- When the response comes back, use `setBookings` to update the results

**Test:**

- [ ] Verify the customers data are still displayed correctly in the table.

Hướng dẫn đóng góp

Chưa lập chỉ mục được hướng dẫn đóng góp cho kho mã nguồn này

Đánh giá

Issue này chưa được đánh giá.

Nhận issue mới trong hộp thư của bạn

Bản tóm tắt ngắn những issue GitHub phù hợp với người mới.