import { useState } from 'react'
import { useRef } from 'react'
// import './App.css'
function Son(props) {
console.log(props,"props的值")
return(
<div>这是儿子组件
{props.children}
</div>
)
}
function App() {
const [count, setCount] = useState(0)
const inputRef = useRef(null)
return (
<>
<Son>
<div>这是传给儿子chilren里面的话</div>
</Son>
</>
)
}
export default App
组件传参,子组件嵌套标签,在父组件使用,等于给父组件的props.children传参数值
最新推荐文章于 2024-11-02 12:42:04 发布