1.8.0 • Published 2 years ago
@s-ui/react-layout-breakpoint-split v1.8.0
LayoutBreakpointSplit
Show or hide views according to the breakpoint.
Installation
$ npm install @s-ui/react-layout-breakpoint-split --save
Usage
Basic usage
import LayoutBreakpointSplit from '@s-ui/react-layout-breakpoint-split'
setView(current) {
this.setState({current})
}
const current = this.state && this.state.current || 0
return (<div>
<LayoutBreakpointSplit breakpoint={575} current={current}>
<div>
LEFT VIEW {current == 0 && '(active)'}
<button onClick={this.setView.bind(this, 1)}>Next ></button>
</div>
<div>
RIGHT VIEW {current == 1 && '(active)'}
<button onClick={this.setView.bind(this, 0)}>Prev <</button>
</div>
</LayoutBreakpointSplit>
</div>)