"use client"; import { useFormState } from "react-dom"; import { addSong, searchSongs } from "./actions"; export default function SearchForm({ className, }: { className?: string | undefined; }) { const [items, dispatch] = useFormState(searchSongs, []); const [_, dispatchAdd] = useFormState(addSong, undefined); return (
{items ? (
{items.map((item) => (
{item.name} - {item.artist}
))}
) : null}
); }