function HelloMessage(props) {
return <h1>Hello World!</h1>;
}
const element = <HelloMessage />;
ReactDOM.render(
element,
document.getElementById('example')
);
function HelloMessage(props) {
return <h1>Hello {props.name}!</h1>;
}
const element = <HelloMessage name="xxx"/>;
ReactDOM.render(
element,
document.getElementById('example')
);
function Name(props) {
return <h1>网站名称:{props.name}</h1>;
}
function Url(props) {
return <h1>网站地址:{props.url}</h1>;
}
function Nickname(props) {
return <h1>网站小名:{props.nickname}</h1>;
}
function App() {
return (
<div>
<Name name="xxx" />
<Url url="http://www.xxx.com" />
<Nickname nickname="xx" />
</div>
);
}
ReactDOM.render(
<App />,
document.getElementById('example')
);