React Hooks
React hooks for data fetching, mutations, and real-time updates. Requires the RefletProvider wrapper.
Provider setup
import { RefletProvider } from "reflet-sdk/react";
function App({ children }) {
return (
<RefletProvider
publicKey="fb_pub_xxx"
user={{ id: "user_123", email: "user@example.com" }}
>
{children}
</RefletProvider>
);
}Available hooks
useFeedbackList
Fetch a paginated list of feedback items with filters.
const { data, isLoading } = useFeedbackList({
status: "open",
sortBy: "votes",
limit: 20,
});useFeedback
Fetch a single feedback item by ID.
const { data, isLoading } = useFeedback(feedbackId);useVote
Toggle a vote on a feedback item.
const { mutate: vote } = useVote();
vote({ feedbackId: "abc123" });useCreateFeedback
Submit new feedback.
const { mutate: create } = useCreateFeedback();
create({ title: "New idea", description: "Details..." });useComments
Fetch comments for a feedback item.
const { data: comments } = useComments(feedbackId);useAddComment
Add a comment or reply to a feedback item.
const { mutate: addComment } = useAddComment();
addComment({ feedbackId, body: "Great idea!" });useRoadmap
Fetch the organization's roadmap with lanes and items.
const { data: roadmap } = useRoadmap();useChangelog
Fetch changelog entries.
const { data: entries } = useChangelog();useOrganizationConfig
Fetch organization settings, statuses, and branding.
const { data: config } = useOrganizationConfig();useSubscription
Subscribe/unsubscribe to a feedback item for updates.
const { mutate: subscribe } = useSubscription();
subscribe({ feedbackId, action: "subscribe" });