{"size": 449, "ext": "js", "max_stars_repo_path": "src/components/Word.js", "max_stars_repo_name": "pnevares/guessing-game", "max_stars_repo_stars_event_min_datetime": null, "max_stars_repo_stars_event_max_datetime": null, "max_issues_repo_path": "src/components/Word.js", "max_issues_repo_name": "pnevares/guessing-game", "max_issues_repo_issues_event_min_datetime": "2019-12-05T12:49:42.000Z", "max_issues_repo_issues_event_max_datetime": "2022-02-26T04:42:09.000Z", "max_forks_repo_path": "src/components/Word.js", "max_forks_repo_name": "pnevares/guessing-game", "max_forks_repo_forks_event_min_datetime": null, "max_forks_repo_forks_event_max_datetime": null}
{"max_stars_count": null, "max_issues_count": 6, "max_forks_count": null, "avg_line_length": 22.45, "max_line_length": 76, "alphanum_fraction": 0.6236080178}
/* eslint-disable react/no-array-index-key */

import React, { memo } from "react";
import PropTypes from "prop-types";

const Word = memo(({ matches, word }) => (
  <p>
    {word.split("").map((letter, index) => (
      <span key={`${letter}${index}`}>{matches[index] ? letter : "_"}</span>
    ))}
  </p>
));

Word.propTypes = {
  matches: PropTypes.arrayOf(PropTypes.bool).isRequired,
  word: PropTypes.string.isRequired
};

export default Word;
