Defining the links to the main page

Now, we just need a way to get back to the main page from a single post page. We are going to repeat a similar process to what we have done previously. Let's define the links back to the main page now:

  1. Edit src/pages/PostPage.js, and import the Link component there:
import { Link } from 'react-navi'
  1. Then, insert a new link back to the main page, before displaying the post:
    return (
<div>
<div><Link href="/">Go back</Link></div>
  1. After going to a page, we can now use the Go back link in order to return to the main page:

Displaying a link on the single post page

Now, our app also provides a way back to the home page.

..................Content has been hidden....................

You can't read the all page of ebook, please click here login for view all page.
Reset
18.118.226.105