In this episode, we're moving on from our Create Discussion form and start building out the reply (Create Post) form for our discussion forum. Rather than starting from scratch, we duplicate our existing discussion form and refactor it to fit the needs of a reply form. That means simplifying things—no title needed for replies, just a body for the content. We also set up a new composable (useCreatePost
) to manage the visibility and state for this new form.
Throughout the episode, we make sure to only display the reply form appropriately, depending on things like authentication and permissions (which we'll dig into more next episode). We walk through updating our UI to add "Reply to discussion" buttons and connect everything up so the correct discussion context is passed when replying.
Along the way, we troubleshoot a few common mistakes, like variable name clashes, and confirm that everything works as intended—markdown preview included! By the end, the basic reply functionality is in place, and we're set up to tackle permissions next. If you've been following along, you now have both new discussion and reply forms working in your forum app!