{"size": 723, "ext": "js", "max_stars_repo_path": "react-hooks-play/src/authField.js", "max_stars_repo_name": "bolbken/archive-01", "max_stars_repo_stars_event_min_datetime": null, "max_stars_repo_stars_event_max_datetime": null, "max_issues_repo_path": "react-hooks-play/src/authField.js", "max_issues_repo_name": "bolbken/archive-01", "max_issues_repo_issues_event_min_datetime": null, "max_issues_repo_issues_event_max_datetime": null, "max_forks_repo_path": "react-hooks-play/src/authField.js", "max_forks_repo_name": "bolbken/archive-01", "max_forks_repo_forks_event_min_datetime": null, "max_forks_repo_forks_event_max_datetime": null}
{"max_stars_count": null, "max_issues_count": null, "max_forks_count": null, "avg_line_length": 23.3225806452, "max_line_length": 79, "alphanum_fraction": 0.5878284924}
import React from "react";

import useAuthField from "./useAuthField";

const authField = ({ label, input }) => {
  const { values, handleChange, validations, handleValidation } = useAuthField(
    login
  );

  function login() {
    console.log(values);
  }

  return (
    <div className="field" key="input.name">
      <label className="label">{label}</label>
      <div className="control">
        <input
          className="input"
          type={input.type}
          name={input.name}
          onChange={handleChange}
          value={values[input.name]}
          required={input.required}
        />
        {handleValidation(values[input.name], input.name, input.validRegExp)}
      </div>
    </div>
  );
};
