React学习案例二十五
<!DOCTYPE html><html><head><meta charset="UTF-8"/><title>React 实例</title></head><body><div id="example"></div><script type="text/babel">
function UserGreeting(props){return<h1>欢迎回来!</h1>;}
function GuestGreeting(props){return<h1>请先注册。</h1>;}
function Greeting(props){
const isLoggedIn = props.isLoggedIn;if(isLoggedIn){return<UserGreeting />;}return<GuestGreeting />;}
ReactDOM.render(// Try changing to isLoggedIn={true}:<Greeting isLoggedIn={false}/>,
document.getElementById('example')
function UserGreeting(props){return<h1>欢迎回来!</h1>;}
function GuestGreeting(props){return<h1>请先注册。</h1>;}
function Greeting(props){
const isLoggedIn = props.isLoggedIn;if(isLoggedIn){return<UserGreeting />;}return<GuestGreeting />;}
ReactDOM.render(// Try changing to isLoggedIn={true}:<Greeting isLoggedIn={false}/>,
document.getElementById('example')
function UserGreeting(props){return<h1>欢迎回来!</h1>;}
function GuestGreeting(props){return<h1>请先注册。</h1>;}
function Greeting(props){
const isLoggedIn = props.isLoggedIn;if(isLoggedIn){return<UserGreeting />;}return<GuestGreeting />;}
ReactDOM.render(// Try changing to isLoggedIn={true}:<Greeting isLoggedIn={false}/>,
document.getElementById('example')
本文转载自: https://blog.csdn.net/m0_54218263/article/details/122837320
版权归原作者 hhh江月 所有, 如有侵权,请联系我们删除。
版权归原作者 hhh江月 所有, 如有侵权,请联系我们删除。