Skip to main content

Advanced Customization

Deeper customizations involving hooks, context, utilities, and integration with your own systems.

Modifying Hooks

The /hooks/ directory contains the core logic for each component. This is where you customize behavior at a deeper level than editing JSX.

Change Default Sort Order

The section starts sorted by "top". To start newest first instead, change defaultSortBy (and add defaultSortDir) where the hook sets up the comment section:

Change Comments Per Page

Customize Reply Depth Limit

The Reply button of each comment is rendered by ReplyButtonAndInfo, and its canReply prop hides the button. Each comment knows its own depth (0 for a top-level comment):
Replies already posted deeper than the limit are still shown.

User Interaction Callbacks

Both comment hooks expose behavioral callbacks you can customize in the hook file:

Customizing Context

The ui-state-context.tsx provides shared state across all sub-components. Add custom state here to make it accessible throughout the component tree:

Adding Utility Functions

Create new files in the /utils/ directory for shared logic:
Then import and use it in any component:

Replacing Sub-Components

For major UI changes, replace a sub-component with your own implementation:

Integrating with External Systems

Connecting to Your Auth System

Connecting to Your User System

Connecting to Your Notification System

Wire the highlightedCommentId prop to deep-link from your notifications:
In threaded comments on React Native and Expo, highlightedCommentId goes on ThreadedComments, which wraps the screen.

Performance Optimization

Memoize the Component

Wrap the component if its parent re-renders frequently:
The installed utils/prop-comparison.ts already handles deep equality checks for entity props to prevent unnecessary re-renders.

Lazy Load on Scroll


Next Steps

Customization Overview

Customization introduction

Colors & Theming

Customize colors and dark mode

Adding Features

Common feature additions

File Structure

Understand component organization