i am having the same issue here in the below code. I have added a key where think it is appropriete but still getting key warning message. Hi guys, i am having the same issue here in the below code. I have added a key where think it is appropriete but still getting key warning message.
Can you help, please?
Leo
import { useState } from "react";
import { FaTimes } from "react-icons/fa";
import EditSkillsForm from "./editSkillsForm";
const SkillsList = ({ inputs, handleDeleteClick, handleCancelClick, handleEditClick, setIsEditing, handleUpdateInput,currentInput}) => {
const [ isEditing, setISEditing ] = useState(false);
//const [ currentSkill, setCurrentSkill ] = useState({});
handleEditClick = () => {
setISEditing(true);
console.log("editing", true)
}
return (
<div className="col-lg-4 col-sm-6 mb-4">
<div className="card p-2">
<div className="card-Header text-center mb-4">
<h4 className="card-title mt-2">Mastered Skills List</h4>
</div>
{inputs.map((skill, idx) => {
return (
<>
<div className="card width: 10rem; mb-3 p-2" key={idx}>
<div className="card-header text-center mb-4">
<h5 className="card-title mt-2">{skill}</h5>
</div>
<img src="../../logo.svg" className="card-img-top" alt="..." key={idx} />
<div className="card-body">
<div className="card-title text-center mt-2 " key={idx}>
{
isEditing ? (
<div key={idx}>
<EditSkillsForm
inputs={inputs}
editing={setIsEditing}
cancelClick= {handleCancelClick}
updateInput = {handleUpdateInput}
currentInput={currentInput}
/>
</div>
) : null
}
{/* <EditSkillsForm inputs={inputs} /> */}
<ol key={idx}>
Skill name: {skill}
</ol>
</div>
</div>
<div className="card-footer" >
<div className="row mb-2" key={idx}>
<button
className="btn btn-primary w-100"
onClick={() => handleEditClick(inputs.idx)}>Edit
</button>
</div>
<div className="row">
<FaTimes className="mb-2" fill="#ffc800" onClick={() => handleDeleteClick(idx)} key={idx} />
</div>
</div>
</div>
</>
)
}
)}
</div>
</div>
);
}
export default SkillsList;