课程: Learning Full-Stack JavaScript Development: MongoDB, Node, and React
今天就学习课程吧!
今天就开通帐号,24,700 门业界名师课程任您挑!
Handling browser navigation history
课程: Learning Full-Stack JavaScript Development: MongoDB, Node, and React
Handling browser navigation history
- [Instructor] When we go to the page for a single contest right now, we just change the state of the application to render that, but we have not changed the URL. Ideally, every contest should get its own URL so that we can share this contest with others. To do that in a single page application, we will have to use the history API, this is not something supported by React, there is no React API to manipulate the history API, but there are libraries out there like React Router that wraps the history API and provides its own API for us to use. But for this course, I'm going to use the native DOM history API, I think it's simple enough for us to use, and I think it's important to understand the core client routing using the native history API. So on the window object in every browser there is a history class, and it has a few functions, the one we need to change a URL of page is pushState, and as you can see from Chrome,…
内容
-
-
-
-
-
-
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 秒
-
-