react-huc
v0.0.1
Published
huc means hub component
Downloads
4
Readme
React Huc
React Huc is a container
Install
$ npm install react-huc -S
usage
import Huc from 'react-huc'
<Huc initStore={{isShow: false}}>
<Child1 />
<Child2 />
</Huc>
//Child1
render() {
const {isShow} = this.props
return (
<div>{isShow}</div>
)
}
//Chil2
render(){
const {isShow, dispatch} = this.props
return (
<div>
<button onClick={()=> dispatch({isShow: !isShow})}>toggle</button>
</div>
)
}