جواب «Find the Bugs» چالش 6 از جلسهی 3
سؤال
صفحهی خبر باید تیتر News و دو خط خبر را نشان بدهد، ولی دو اشتباه دارد و اجرا نمیشود. هر دو را درست کن.
راهنمایی: به حرف اول اسمها نگاه کن.
راهنما
تابع باید Story باشد (با S بزرگ) و در App باید <Title /> بنویسی، نه <title />.
یک جواب درست
<style>
body { font-family: sans-serif; text-align: center; padding: 16px; }
button, input, select { font-size: 16px; min-height: 40px; margin: 4px; }
</style>
<div id="root" dir="ltr"></div>
<script type="text/jsx">
import { createRoot } from "react-dom/client";
function Title() {
return <h1 id="title">News</h1>;
}
function Story() {
return <p>Rain tomorrow</p>;
}
function App() {
return (
<div>
<Title />
<Story />
<Story />
</div>
);
}
createRoot(document.getElementById("root")).render(<App />);
</script>
اول خودت امتحان کن؛ جوابهای دیگر هم قبول است. برگرد و خودت حلش کن