0.0.1 • Published 8 years ago

react-huc v0.0.1

Weekly downloads
2
License
MIT
Repository
-
Last release
8 years ago

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>
  )
}