课程: Learning Full-Stack JavaScript Development: MongoDB, Node, and React
今天就学习课程吧!
今天就开通帐号,24,700 门业界名师课程任您挑!
Sharing data between server and client
课程: Learning Full-Stack JavaScript Development: MongoDB, Node, and React
Sharing data between server and client
- In index dot tsx, we're rendering the contests with an empty array. So let me demonstrate what's going on. In contest list, I'm going to put a debugger line here. So every time React renders a contest list, it's going to stop for us in the browser and let's test. The first time we hit this debugger, note how we already have the initial markup coming from the server even before React renders any components. Then we render the contest list and we render it with an empty array. So basically React wiped the initial markup that we got from the server, rendered the naming contests with an empty array, and it then goes to the server again to get the data and renders the application again with that data. So that's not ideal. We don't need to do that. This is an extra API call and also wasteful re-rendering. We don't need React to re-render. It already has the same application rendered in the browser. It does not need to wipe…
内容
-
-
-
-
-
Creating a mock API endpoint5 分钟 52 秒
-
(已锁定)
Using an API endpoint from the browser9 分钟 2 秒
-
(已锁定)
Rendering a list of items8 分钟 47 秒
-
(已锁定)
React’s key for items in a list4 分钟 29 秒
-
(已锁定)
Fetching data while React is rendering8 分钟 5 秒
-
(已锁定)
Server-side rendering of the root path7 分钟 41 秒
-
(已锁定)
Sharing data between server and client5 分钟 1 秒
-
(已锁定)
Fetching data from MongoDB6 分钟 17 秒
-
-
-