Documentation
Hooks
usePostNote

usePostNote

Hook for posting a note. For more information, check out Note Metadata (opens in a new tab).

import { UseMutationResult, UseMutationOptions } from "@tanstack/react-query";
import { NoteMetadata } from "crossbell";
 
function usePostNote(
	options?: UseMutationOptions
): UseMutationResult<unknown, unknown, { metadata: NoteMetadata }>;

Usage

import { usePostNote } from "@crossbell/connect-kit";
 
function App() {
	const postNote = usePostNote();
 
	return (
		<button
			onClick={() => {
				postNote.mutate({
					metadata: {
						content: "Hello Word!",
						sources: ["Crossbell Dev"],
						external_urls: ["https://crossbell.io"],
						tags: ["post"],
					},
				});
			}}
		>
			Post Note
		</button>
	);
}