"use client"; import { useState, useEffect } from "react"; import { getRating, setRating } from "@/app/lib/learning"; export function RatingSection() { const [stars, setStars] = useState(0); const [comment, setComment] = useState(""); const [submitted, setSubmitted] = useState(false); useEffect(() => { const r = getRating(); if (r) { setStars(r.stars); setComment(r.comment); setSubmitted(true); } }, []); const handleSubmit = () => { setRating(stars, comment); setSubmitted(true); }; return (

课程评价

你的反馈对我们很重要

{submitted ? (

感谢你的评价 ✓

) : ( <>
{[1, 2, 3, 4, 5].map((n) => ( ))}