My-Dictionary-React-Application / src / listForSynonyms.js
listForSynonyms.js
Raw
import React from "react";
import "./reactStyling.css";

function Synonyms(props) {
  if (props.list.length > 0) {
    return (
      <ul className="synonyms-ul">
        <div className="synonyms-div">Similar</div>
        {props.list.map(function (item, index) {
          return (
            <li key={index} className="synonyms-li">
              {item}
            </li>
          );
        })}
      </ul>
    );
  } else {
    return null;
  }
}

export default Synonyms;