fixed a bug when deleting elements

This commit is contained in:
Daria Golova
2022-07-27 14:28:11 +03:00
parent b7be78cf76
commit f31c895b8d
2 changed files with 23 additions and 20 deletions

View File

@@ -3,12 +3,11 @@ import ProfileTableItem from './ProfileTableItem';
import ProfileIcon from '../../images/profile-icon.svg';
function ProfileTable({
selectedItems,
userData
userData,
handleClick,
isCheck,
}) {
const [isCheck, setIsCheck] = useState([]);
const defaultData = {
image: ProfileIcon,
status: 'Stored',
@@ -16,19 +15,6 @@ function ProfileTable({
avatars: null
};
useEffect(() => {
selectedItems(isCheck);
// eslint-disable-next-line react-hooks/exhaustive-deps
}, [isCheck]);
const handleClick = e => {
const { id, checked } = e.target;
setIsCheck([...isCheck, id]);
if (!checked) {
setIsCheck(isCheck.filter(item => item !== id));
}
};
const data = {
general:["First name","Second name", "Gender", "Birthdate", "Place of birth"],
nationality:["Nationality", "National ID", "National doctype", "National doc ID", "National doc issue date", "National doc expiry date"],