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 - Laravel Tutorial
From the course: Building a Website with Laravel, React.js, and Inertia
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
-
-
-
-
React and Laravel setup3m 32s
-
(Locked)
Creating the Home and About pages1m 52s
-
(Locked)
Creating website navigation3m 24s
-
(Locked)
Displaying posts on a website2m 10s
-
(Locked)
Refactoring to components1m 52s
-
(Locked)
Fetching posts from Laravel API2m 22s
-
(Locked)
Creating a new post3m 43s
-
(Locked)
Updating a post2m 40s
-
(Locked)
Deleting a post1m 42s
-
(Locked)
Challenge: Show individual post page56s
-
(Locked)
Solution: Show individual post page2m 4s
-
-
-