The Provider Pattern
The comment system uses aCommentSectionProvider + useCommentSection pair. Wrap your comment UI with CommentSectionProvider to load comments for an entity, then access all comment state and actions from any descendant with useCommentSection.
What the Provider Manages
- Loading comments — fetches the first page on mount and provides
loadMorefor pagination - Comment tree — maintains a
entityCommentsTreewith comments and their replies organized as a map - New comments — tracks freshly submitted comments separately from paginated ones
- Highlighted comment — fetches and highlights a specific comment (e.g., from a deep link)
- Reply state — tracks which comment is being replied to and shows/hides the reply banner
- CRUD actions —
createComment,updateComment,deleteCommentwith optimistic updates - Sort —
sortByandsetSortByfor switching between"top","new", and"controversial"
In This Section
Comment Section
Full guide to CommentSectionProvider props and the useCommentSection hook values.
Pre-Built Comment Components
If you’d rather not wire up your own comment UI, Replyke provides two production-ready comment components installed via the CLI directly into your project as editable source code.Threaded Comments
A classic threaded comment section with nested replies, reactions, and sorting. Ideal for blogs, docs, and long-form content.
Social Comments
A flat social-style comment feed with inline replies and a familiar social media feel. Great for feeds, posts, and community content.
CommentSectionProvider and useCommentSection — the same primitives documented here — so you can customize them as deeply as needed after installation.

