useDeleteList
Overview
The useDeleteList
hook is used to delete a specified list within the current project. Note that root lists (lists without a parent) cannot be deleted using this hook.
Usage Example
import { useDeleteList } from "@replyke/react-js";
function DeleteListButton({ list }: { list: List }) {
const deleteList = useDeleteList();
const handleDeleteList = async () => {
try {
await deleteList({ list });
console.log("List deleted successfully");
} catch (error) {
console.error("Failed to delete list:", error.message);
}
};
return <button onClick={handleDeleteList}>Delete List</button>;
}
Parameters & Returns
Parameters
The hook returns a function that accepts an object with the following field:
Parameter | Type | Required | Description |
---|---|---|---|
list | List | Yes | The list to be deleted. Root lists cannot be deleted. |
Returns
The function does not return a value but ensures the specified list is deleted on the server upon successful execution.