'React-Native check if mandatory fields are filled

I have a class called person which has a lot of fields I am registering a new user in my application and I am trying to see if all mandatory fields are filled, the fields are, first_name, last_name, phone number etc... But this code below expects all fields to be filled I guess, I just want to check the fields with the names given below, hope someone can help?

useEffect(() => {
    const checkMandatoryFields = Object.keys(person).every(field => {
      if (
        field == 'first_name' ||
        field == 'last_name' ||
        field == 'phone' ||
        field == 'plate' ||
        field == 'brand' ||
        field == 'model' ||
        field == 'password'
      )
        return true;
      return !!person[field];
    });

    setDisableSubmit(!checkMandatoryFields);
  }, [person]);


Sources

This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.

Source: Stack Overflow

Solution Source