From the course: Building a Website with Laravel, React.js, and Inertia

Unlock the full course today

Join today to access over 24,400 courses taught by industry experts.

Solution: Show individual post page

Solution: Show individual post page

(upbeat music) - [Instructor] Welcome back. How did it go? Did you manage to complete a challenge? This is how I did it. First of all, I created a new route Inside app.jsx. Then I imported a show component that doesn't exist just yet at the top of the page. Then I created a show component inside the post directory. And this is the code. Let's go over it together. I am using the use location hook to fetch the information from the location state object. I used that object to populate the title, the author, and the body of the post. Then I added the go back button to take the user back to the homepage. Finally, I made the title of the post on the index page into a link to take the user to the post and change the styling on hover to let the user know it's clickable. Let's test it out, the title is now a link, and when I click on it, here is our page. It works. The app could be further styled and refactored. We could move the edit and delete post buttons to the post page to make it more…

Contents