摘要: 函数组件 // src/components/Hello1.jsx import { useState } from 'react' function Hello1 (props) { const [ hello1, setHello1 ] = useState('world1') setTimeo 阅读全文
posted @ 2025-11-05 11:36 龚思凯1 阅读(2) 评论(0) 推荐(0)
摘要: 方式一 let content; if (isLoggedIn) { content = <AdminPanel />; } else { content = <LoginForm />; } return ( <div> {content} </div> ); 方式二 <div> {isLogge 阅读全文
posted @ 2025-11-05 11:26 龚思凯1 阅读(2) 评论(0) 推荐(0)
摘要: 函数组件 // src/components/Hello1.jsx import { useState } from 'react' function Hello1 (props) { const [ hello1, setHello1 ] = useState('world1') setTimeo 阅读全文
posted @ 2025-11-05 11:18 龚思凯1 阅读(2) 评论(0) 推荐(0)
摘要: 函数组件 // src/components/Hello1.jsx import { useState } from 'react' function Hello1 () { const [ hello1, setHello1 ] = useState('world1') setTimeout(() 阅读全文
posted @ 2025-11-04 15:29 龚思凯1 阅读(2) 评论(0) 推荐(0)
摘要: 函数组件 // src/components/Hello1.jsx import { useState } from 'react' function Hello1 () { const [ hello1, setHello1 ] = useState('world1') return ( <div 阅读全文
posted @ 2025-11-04 15:28 龚思凯1 阅读(2) 评论(0) 推荐(0)
摘要: 函数组件 // src/components/Hello1.jsx import { useState } from 'react' function Hello1 () { const [ hello1, setHello1 ] = useState('world1') return ( <div 阅读全文
posted @ 2025-11-04 15:27 龚思凯1 阅读(3) 评论(0) 推荐(0)
摘要: 函数组件 // src/components/Hello1.jsx function Hello1 () { return ( <div> hello1 </div> ) } export default Hello1; 类组件 // src/components/Hello2.jsx import 阅读全文
posted @ 2025-11-04 15:26 龚思凯1 阅读(2) 评论(0) 推荐(0)
摘要: 创建项目 npx create-react-app react-practice 启动项目 npm start 阅读全文
posted @ 2025-11-04 11:58 龚思凯1 阅读(2) 评论(0) 推荐(0)