课程: Learning Full-Stack JavaScript Development: MongoDB, Node, and React
今天就学习课程吧!
今天就开通帐号,24,700 门业界名师课程任您挑!
Fetching data after navigating to a new view
课程: Learning Full-Stack JavaScript Development: MongoDB, Node, and React
Fetching data after navigating to a new view
- [Instructor] We have a contest component and it receives the idea of the contest. And now we need to fetch the information for a single contest and display it in this contest component. It's very similar to what we did in the contest list component. So, we start by having an object on the state that we can change so that the component re-renders. So, I'm going to name this one Contest and update our function set contest. And this is a use state call from React and it's undefined by default. Then we do a use effect call from React just like we did in the contest list component. And in here we need to fetch a single contest. Now we don't have that API yet, so let's go write it. This would be in the API client, very similar to fetch contests. Let me actually name this Fetch Contest List. I think that's more readable. We would need to change it everywhere. Fetch contests. So, in here it is fetch contest list and on…
内容
-
-
-
-
-
-
Invoking component actions in children7 分钟 40 秒
-
(已锁定)
Displaying a different root component4 分钟 7 秒
-
(已锁定)
Fetching data after navigating to a new view7 分钟 15 秒
-
(已锁定)
Handling browser navigation history7 分钟 14 秒
-
(已锁定)
Server-side rendering of a custom path7 分钟 28 秒
-
(已锁定)
Fetching data conditionally4 分钟 16 秒
-
(已锁定)
Navigating on link click6 分钟 11 秒
-
-