import React from 'react'; import { setPublishInChannel } from '../actions/index'; import { connect } from 'react-redux'; class AnonymousOrChannelSelect extends React.Component { constructor (props) { super(props); this.toggleAnonymousPublish = this.toggleAnonymousPublish.bind(this); } toggleAnonymousPublish (event) { const value = event.target.value; if (value === 'anonymous') { this.props.onPublishInChannelChange(false); } else { this.props.onPublishInChannelChange(true); } } render () { return (
); } } const mapStateToProps = state => { return { publishInChannel: state.publishInChannel, }; }; const mapDispatchToProps = dispatch => { return { onPublishInChannelChange: (value) => { dispatch(setPublishInChannel(value)); }, }; } export default connect(mapStateToProps, mapDispatchToProps)(AnonymousOrChannelSelect);