title: Comparing objects, checkbox checking, edit checkboxs
body: <p>In the following line:
   </p>
  
  <pre><code>checked={this.state.peopleChecked.some(({ asset}) =&gt; asset['object'] ['user']['id'] === person.userCompetences.map((user, index) =&gt; {
     user['asset']['id']
   })
  )}
  </code></pre>
  
  <p>I have a problem comparing two objects.
  Compares a property from the array <code>people</code> -><code>userCompetences</code> -> <code>asset</code> -><code>id</code> with an object from the array <code>peopleChecked</code> -><code>asset</code> -> <code>object</code> -><code>user</code> - > <code>asset_id</code>.
  if <code>id</code> from array<code>people</code> and <code>asset_id</code>, <code>id === asset_id</code> are equal to returns<code>true</code>. Checkbox is checked</p>
  
  <p>Code here: <a href="https://stackblitz.com/edit/react-n2zkjk" rel="nofollow noreferrer">https://stackblitz.com/edit/react-n2zkjk</a></p>
  
  <pre><code>class App extends Component {
    constructor() {
      super();
      this.state = {
        people: [
              {
                firstname: "Paul",
                userCompetences: [
                  { asset:{ 
                      id: "12345" 
                    }    
                  }
                ]
              },
              {
                  firstname: "Victor",
                  userCompetences: [
                    {  asset: {
                          id: "5646535"     
                      }
                    }
                  ]
              },
              {
                  firstname: "Martin",
                  userCompetences: [
                    {  asset: {
                          id: "097867575675"     
                      }
                    }
                  ]
              },
              {
                  firstname: "Gregor",
                  userCompetences: [
                    {  asset: {
                          id: "67890"     
                      }
                    }
                  ]
              }
          ],
         peopleChecked: [   
            {
              amount: 0,
              asset: {
                id: "fgfgfgfg",
                object: {
                    competence: null,
                    id: "dsdsdsdsd",
                    user: {
                        firstname: "Gregor",
                        asset_id: "67890"
                    }
                }
              }
            },
             {
              amount: 0,
              asset: {
                id: "dsdsdsd",
                object: {
                    competence: null,
                    id: "wewewe",
                    user: {
                        firstname: "Paul",
                        asset_id: "12345"
                    }
                }
              }
            },
        ],
        selectPeopleId: []
      }
    }
  
    /*handleSelect = (person) =&gt; {
  
      //Check if clicked checkbox is already selected
      var found = this.state.peopleChecked.find((element) =&gt; {
        return element.id == person.id;
      });
  
      if(found){
        //If clicked checkbox already selected then remove that from peopleChecked array
        this.setState({
          peopleChecked: this.state.peopleChecked.filter(element =&gt; element.id !== person.id),
          selectPeopleId: this.state.selectPeopleId.filter(element =&gt; element !== person.id)
        }, () =&gt; console.log(this.state.peopleChecked))
      }else{
        //If clicked checkbox is not already selected then add that in peopleChecked array
        this.setState({
          selectPeopleId: [...this.state.selectPeopleId, person.id],
          peopleChecked: [...this.state.peopleChecked,person]
        }, () =&gt; {console.log(this.state.selectPeopleId);console.log(this.state.peopleChecked);})
      }
    }*/
  
  
    render() {
      return (
        &lt;div&gt;
          {this.state.people.map(person =&gt; (
            &lt;div key={person.id} className="mb-1"&gt;
              &lt;input 
                type={'checkbox'}
                id={person.id}
                label={person.firstname}
                checked={this.state.peopleChecked.some(({ asset}) =&gt; asset['object']['user']['id'] ===           person.userCompetences.map((user, index) =&gt; {
                    user['asset']['id']
                  })
                )}
                onChange = {() =&gt; this.handleSelect(person)}
              /&gt; {person.firstname}
            &lt;/div&gt;
          ))}
        &lt;/div&gt;
      );
    }
  }
  </code></pre>