import React, { useOptimistic } from 'react'; function ContactForm() { const [optimisticData, addOptimisticData] = useOptimistic( { name: '', email: '', message: '' }, (prevData, newData) => ({ ...prevData, ...newData }) ); async function handleSubmit(formData) { // 楽観的な更新を適用 addOptimisticData({ name: formData.get('name'), email: formData.get('email'), message: formData.get('message'), }); // 非同期操