export function Name(props: { id: string }) { const [records, setRecords] = useState<string[]>([]); const { id } = props; useEffect(() => { if (!id) return; const load = async () => { const data = await getDataById(id); setRecords(data); }; load(); }, [id]); return <>{records}</>; };
443200cookie-checkReact Basic Functional Component