const IDs = Object.entries(formData?.Recipient).map(([k, v]) => v.map(item => item?.UserID)); this.setState({ selectedUser : IDs.flat() }) console.log(IDs.flat())