You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: README.md
+10Lines changed: 10 additions & 0 deletions
Original file line number
Diff line number
Diff line change
@@ -61,6 +61,16 @@ Default value is set to false.
61
61
62
62
Polling is paused when the window lose focus. To fix that issue we can set `refetchIntervalInBackground` property to true.
63
63
64
+
6. Homework (Solution on branch: feature/09-homework)
65
+
66
+
Combine polling with callbacks. Use the `refetchInterval` option to pull the api data every 3 seconds. Behind the scenes add a fourth superhero of your choice to the superheroes array in `db.json`.
67
+
68
+
a.) Within the onSuccess callback check if the number of heroes is 4 and ifit is the case I want you to stop the polling.
69
+
b.) Within the onError callback I want you to stop the polling.
70
+
71
+
Hint:
72
+
Mantain state variable whose initial value is 3000. State variable will be assigned to `refetchInterval` configuration. In callbacks check for the response / errors and set the state variable to false.
0 commit comments