Menu
×
×
正确
import { useState, useEffect } from "react";
import ReactDOM from "react-dom/client";
function App() {
const [data, setData] = useState([]);
useEffect(() => {
setData(getData())
}, []);
return <DisplayData data={data} />;
}
const root = ReactDOM.createRoot(document.getElementById('root'));
root.render(<App />);
不正确点击 此处 重试 正确下一题 ❯import { useState, useEffect } from "react"; import ReactDOM from "react-dom/client"; function App() { const [data, setData] = useState([]); useEffect(() => { setData(getData()) },); return <DisplayData data={data} />; } const root = ReactDOM.createRoot(document.getElementById('root')); root.render(<App />); |