【文件属性】:
文件名称:react-subcomponent:无状态React组件
文件大小:4KB
文件格式:ZIP
更新时间:2021-05-31 22:14:18
JavaScript
React子组件
无状态React组件
用法
持有状态的父级:
import React from 'react' ;
import Child from './child.js' ;
class Parent extends React . Component {
constructor ( props ) {
super ( ) ;
this . state = {
// some state
}
}
render ( ) {
return (
< Child xss=removed>
) ;
}
}
没有状态但可以访问和设置其父状态的子级:
import React from 'react' ;
i
【文件预览】:
react-subcomponent-master
----package.json(602B)
----LICENSE(1KB)
----src()
--------index.js(471B)
----.gitignore(271B)
----lib()
--------index.js(3KB)
----README.md(842B)