Internal Agent Interface
import {throughAgent, Item} from 'react-through'
class MyAdvancedAgent extends React.Component {
static propTypes = {
areaAdvanced: PropTypes.object,
}
componentWillMount() {
this.configureItems(this.props)
}
componentWillReceiveProps(nextProps) {
// check this.props and nextProps differences here
// differences = ...
if( differences ) {
this.configureItems(nextProps)
}
}
configureItems = (props) => {
props.areaAdvanced.item(
<Item {...props} />
)
// or
props.areaAdvanced.items(
<div>
<Item bearingProp='first' {...props.first} />
<Item bearingProp='second' {...props.second} />
</div>
)
}
render() {
return null
// or
return (
<div> something here </div>
)
}
}
export default throughAgent('areaAdvanced', 'bearingPropName')(MyAdvancedAgent)
// or
export default throughAgent('areaAdvanced', props => props.bearingProp)(MyAdvancedAgent)Last updated