课程: Learning Full-Stack JavaScript Development: MongoDB, Node, and React

今天就学习课程吧!

今天就开通帐号,24,700 门业界名师课程任您挑!

Navigating on link click

Navigating on link click

- [Instructor] We need to add a link here somewhere. Let's put it at the end of this page to go back to a contest list in case we start the application here. So if someone shared this URL we need to give them a way to go back to the contest list. Let's add it right here below everything. And let's use an anchor element here. So a.link, the atreff here is slash, and for a label let's use contest list. This is an html link and this will actually work. So if you go to contest list, it will work but it goes back to the server to fetch the list of contest. It's not a single page application feature. If you want to make it work without going back to the server, for the html we need a handler. On click is something that we need to define. This function needs to actually change the page state element on the app component. So we need to define it here. And it's very similar to this navigate to contest. So I'm going to start with…

内容