Read the Name چالش 1 از جلسهی 6، آسان
App اسم Ali را به Hello میدهد، ولی تیتر فقط Hello را نشان میدهد. با props.name اسم را بعد از Hello بگذار تا تیتر بشود Hello Ali.
<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 Hello(props) {
return <h1 id="hi">Hello</h1>;
}
function App() {
return <Hello name="Ali" />;
}
createRoot(document.getElementById("root")).render(<App />);
</script>
راهنما و جواب این چالش · برگشت به درس جلسهی 6: props: ورودی قطعهها · چالش بعدی: Give the Name
بیشتر بخوان: جاوااسکریپت چیست؟ از دکمهی وب تا Node.js