Skip to content

Latest commit

 

History

History
59 lines (44 loc) · 878 Bytes

组件.md

File metadata and controls

59 lines (44 loc) · 878 Bytes
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')
);