You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
23 lines
658 B
23 lines
658 B
import { Dispatch } from 'redux'
|
|
import { connect } from 'react-redux'
|
|
|
|
import { setFieldValue } from 'src/actions/forms'
|
|
import { getFieldValue } from 'src/selectors/forms'
|
|
import { AppState } from 'src/types'
|
|
|
|
import CheckboxField, { Props } from './checkbox-field'
|
|
|
|
const mapStateToProps = (state: AppState, ownProps: Props) => ({
|
|
value: getFieldValue<boolean>(state, ownProps.name, false),
|
|
})
|
|
|
|
const mapDispatchToProps = (dispatch: Dispatch, ownProps: Props) => ({
|
|
setValue: (value: boolean) => {
|
|
dispatch(setFieldValue(ownProps.name, value))
|
|
}
|
|
})
|
|
|
|
export default connect(
|
|
mapStateToProps,
|
|
mapDispatchToProps
|
|
)(CheckboxField)
|