课程: Learning Full-Stack JavaScript Development: MongoDB, Node, and React
今天就学习课程吧!
今天就开通帐号,24,700 门业界名师课程任您挑!
Server-side rendering of a custom path
课程: Learning Full-Stack JavaScript Development: MongoDB, Node, and React
Server-side rendering of a custom path
- [Instructor] Now that we have a URL for a contest, let's see what happens when we refresh this page. We did not define a handler for this page on the server, so we need to define that handler and include this component in the server-side logic as well. Let's do that. The first thing that we need to modify is server.ts. In server.ts we said handle the root path. We also needed to handle this path, /contest/id. My plan is to make the server render function path aware as well, so we could reuse this logic for both the root path and the single contest page path. And Express actually support passing an array here with multiple paths to share the same request handling logic. So in here, we can do /contest/ a dynamic contest ID, which is a request param. So just with that change, if we test now and refresh the same page, it'll be handled server-side but it looks like we have a problem in main.js. So let me figure out that problem…
内容
-
-
-
-
-
-
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 秒
-
-