department-of-veterans-affairs/vets-website

View on GitHub
src/applications/benefit-eligibility-questionnaire/components/SubmitHelper.jsx

Summary

Maintainability
A
0 mins
Test Coverage
import React from 'react';
import { connect } from 'react-redux';
import PropTypes from 'prop-types';
import { getResults } from '../reducers/actions';

const SubmitHelper = props => {
  const handleClick = () => {
    props.getResults(props.form.data);
  };
  return (
    <div
      id="submit-helper"
      visible="false"
      aria-hidden="true"
      onClick={handleClick}
      onKeyDown={() => {}}
    />
  );
};

SubmitHelper.propTypes = {
  form: PropTypes.shape({
    data: PropTypes.object,
  }),
  getResults: PropTypes.func,
};

const mapDispatchToProps = {
  getResults,
};

function mapStateToProps(state) {
  return {
    form: state.form,
  };
}

export default connect(
  mapStateToProps,
  mapDispatchToProps,
)(SubmitHelper);