"use client"; import { useActionState } from "react"; import { addMemberAction, type AddMemberState } from "./actions"; const initialState: AddMemberState = null; export function AddMemberForm({ roomId }: Readonly<{ roomId: string }>) { const boundAction = addMemberAction.bind(null, roomId); const [state, action, pending] = useActionState(boundAction, initialState); return (
{state?.error &&

{state.error}

} {state?.success && (

Member added!

)}
); }