import React from 'react' import { connect, ConnectedProps } from 'react-redux' import ShapefileUpload from './ShapefileUpload' import { removeConstraint } from '../actions/constraints' const mapDispatchToProps = (dispatch: (event: any) => any) => { return { onRemove: (index: number) => { dispatch(removeConstraint(index)) }, } } const connector = connect(null, mapDispatchToProps) type ShapefileConstraintProps = ConnectedProps & { index: number } const ShapefileConstraint = ({ index, onRemove }: ShapefileConstraintProps) => { return ( { e.stopPropagation() onRemove(index) }} /> {/* Do not localize */} Shapefile ) } export default connector(ShapefileConstraint)