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 ...

Get Learn React Hooks now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.