课程: Learning Full-Stack JavaScript Development: MongoDB, Node, and React
今天就学习课程吧!
今天就开通帐号,24,700 门业界名师课程任您挑!
Updating UI based on API response
课程: Learning Full-Stack JavaScript Development: MongoDB, Node, and React
Updating UI based on API response
- [Instructor] So how do we update the list of proposed names without refreshing the page? Well, we're rendering the contest information from this contest object, which is a state element. So really, all we need to do is just set contest to be the updated contest and this would make the list of names refresh immediately 'cause React is going to take this updated contest and rerender this component based on updated contest and make its virtual diffing with the previously rendered output and it will figure out that it needs to go to the dom and update the list of names. And really only that because we have not updated anything else on the contest. And let me test that real quick. All right, let's do another awesome name. Inspect the network request. Make sure everything we see there is what to expect. Submit, the name showed up here. We have a 200 request to the API and it returned the updated contest information.
内容
-
-
-
-
-
-
-
(已锁定)
Handling data in an array3 分钟 27 秒
-
(已锁定)
Reading form data with the DOM API6 分钟 49 秒
-
(已锁定)
Understanding HTTP request methods2 分钟 19 秒
-
(已锁定)
Using an API endpoint to update data9 分钟 48 秒
-
(已锁定)
Updating UI based on API response1 分钟
-
(已锁定)
Project challenge2 分钟 1 秒
-
(已锁定)
Next steps1 分钟 27 秒
-
(已锁定)