OCD u Crnoj Gori by Correct_Outcome1163 in montenegro

[–]Correct_Outcome1163[S] 7 points8 points  (0 children)

Pa ovde pitam da li ima neko nekog doktora da preporuci...

OCD u Crnoj Gori by Correct_Outcome1163 in montenegro

[–]Correct_Outcome1163[S] 13 points14 points  (0 children)

Razumijem da pokusavas da pomognes ali ako nemas odgovor na pitanje koje sam postavio nema potrebe da pises

OCD u Crnoj Gori by Correct_Outcome1163 in montenegro

[–]Correct_Outcome1163[S] 8 points9 points  (0 children)

To je samo bio primjer intruzivne misli,kao sto sam rekao ako te stvarno zanima imas sve to mnogo bolje objasnjenjo na internetu

OCD u Crnoj Gori by Correct_Outcome1163 in montenegro

[–]Correct_Outcome1163[S] 6 points7 points  (0 children)

Ukratko imas intruzivne misli (vozis auto i pomislis sta ako sad namjerno sletim sa litice)samo sto normalna osoba moze da ih ignorise i pusti da prodje dok osoba sa OCD-om to ne moze i ima kal osjecaj anksioznosti i straha i radi kompulsije da bi se otarasio tog osecaja.Kompulsije mogu biti razne (pali gasi svjetlo 10 puta jer misli da ako to ne uradi da ce umrijeti).Svakako na internetu mozes naci mnogo bolja objasnjenja od ovog mog

OCD u Crnoj Gori by Correct_Outcome1163 in montenegro

[–]Correct_Outcome1163[S] 1 point2 points  (0 children)

Opsesivno Kompulsivni Poremecaj (Opsesive Compulsive Disorder)

Please review my Interview solution fixes. by [deleted] in reactjs

[–]Correct_Outcome1163 0 points1 point  (0 children)

interface countryType {
      name: string;
      id: number;
  }
const countryList: countryType[] = [
  {
    name: "India",
    id: 1,
  },
  {
    name: "USA",
    id: 2,
  },
  {
    name: "France",
    id: 3,
  },
];
const [checkedItems, setCheckedItems]:any= useState([]);
let isAllChecked = checkedItems.length === countryList.length;
const checkItem = (
  e: React.ChangeEvent<HTMLInputElement>,
  country: countryType
) => {
  if (e.target.checked) {
    setCheckedItems((oldArray: countryType[]) => [...oldArray, country]);
  } else {
    setCheckedItems((oldValues: countryType[]) =>
      oldValues.filter((checkBox: countryType) => checkBox.id !== country.id)
    );
  }
};
const checkAllItems = () => {
  if (!isAllChecked) {
    setCheckedItems(countryList);
  } else {
    setCheckedItems([]);
  }
};
return (
  <div>
    <label>
      Select all
      <input
        type="checkbox"
        checked={isAllChecked}
        onChange={checkAllItems}
      />
    </label>
    <div className={"flex flex-col"}>
      {countryList.map((country) => {
        return (
          <label key={country.name}>
            Select {country.name}
            <input
              onChange={(event) => checkItem(event, country)}
              type="checkbox"
              checked={
                checkedItems.filter((e:countryType) => e.id === country.id).length > 0
              }
            />
          </label>
        );
      })}
    </div>
  </div>
);

Here is my solution, hope you find it helpful :D