React 限定传递的参数类型
import propTypes from 'prop-types'
export default function App() {
let state={
message:'this is message'
}
const getMessage=()=>{
console.log('父组件中的函数')
}
return (
<div>
<Test pageSize={"123"}></Test>
</div>
)
}
Test.propTypes={
pageSize:propTypes.string
}
function Test({pageSize='123'}){
const print=()=>{
console.log(pageSize);
}
return(
<div>
this is test
<button onClick={print}>点击</button>
</div>
)
}
· 阿里巴巴 QwQ-32B真的超越了 DeepSeek R-1吗?
· 10年+ .NET Coder 心语 ── 封装的思维:从隐藏、稳定开始理解其本质意义
· 【译】Visual Studio 中新的强大生产力特性
· 【设计模式】告别冗长if-else语句:使用策略模式优化代码结构
· 字符编码:从基础到乱码解决