{activeRequest ? this.renderRequestPane() :
}
{activeRequest ? this.renderResponsePane() :
}
)
}
}
App.propTypes = {
allRequests: PropTypes.array.isRequired,
activeRequest: PropTypes.object,
loading: PropTypes.bool.isRequired
};
function mapStateToProps (state) {
return {
actions: state.actions,
allRequests: state.requests.all,
activeRequest: state.requests.all.find(r => r.id === state.requests.active),
loading: state.loading
};
}
function mapDispatchToProps (dispatch) {
return {
actions: Object.assign(
{},
bindActionCreators(GlobalActions, dispatch),
bindActionCreators(RequestActions, dispatch)
)
}
}
export default connect(
mapStateToProps,
mapDispatchToProps
)(App);