import { useCallback, useEffect, useState } from 'react'; import Image from 'next/image'; import buildspaceLogo from '../assets/buildspace-logo.png'; const Home = () => { const [input, setInput] = useState(''); const [output, setOutput] = useState(''); const [isGenerating, setIsGenerating] = useState(false); const onChange = (event) => { setInput(event.target.value); }; const generateAction = useCallback(async () => { setIsGenerating(true); const response = await fetch('/api/generate', { method: 'POST', headers: { 'Content-Type': 'application/json', }, body: JSON.stringify({ input }), }); const data = await response.json(); const { baseChoice, finalChoice } = data; setOutput( `Song Titles:${finalChoice.text}\n\nLyrics:\n${input}${baseChoice.text}` ); setIsGenerating(false); }, [input]); return (

Scratchpad

Write your first song in the style of your favorite artist.