Open monsterooo opened 6 years ago
renderNothing和它的名字一样,它是一个返回null的高阶组件
renderNothing
null
renderNothing: HigherOrderComponent
const { compose, branch, renderNothing } = Recompose; const Bar = () => (<p>Bar</p>); const Foo = compose( branch( props => props.isShow, () => Bar, renderNothing, ), )(({ title }) => ( <div>{ title }</div> )) class App extends React.Component { render() { return ( <div> 什么组件也不展示 <Foo isShow={false} /> </div> ); } } ReactDOM.render(<App />, document.getElementById('app'))
在codepen在线预览
renderNothing 介绍
renderNothing
和它的名字一样,它是一个返回null
的高阶组件renderNothing Flow Type
renderNothing 例子
在线DEMO
在codepen在线预览