compareRoles() {
        let arrSelectedRoles = []
        for (var i = 0; i < this.state.userRoles.length; i++) {
            for (var j = 0; j < this.state.roles.length; j++) {
                if (this.state.roles[j].name == this.state.userRoles[i]) {
                    arrSelectedRoles.push(this.state.roles[j].id)
                }
            }
        }
        console.log(arrSelectedRoles)

        this.setState({ selectedRoles: arrSelectedRoles })
        console.log(this.state)
    }
/* compare user's roles to list of roles to get the id of the selected roles()
  and use them to update the selectedRoles state which highlight the selected
  roles in the dropdown list */
compare user's roles to list of roles to get the id of the selected roles()
and use them to update the selectedRoles state which highlight the selected
roles in the dropdown list
compare user ' s roles to list of roles to get the id of the selected roles () and use them to update the selectedRoles state which highlight the selected roles in the dropdown list
compareRoles() {
        let arrSelectedRoles = []
        for (var i = 0; i < this.state.userRoles.length; i++) {
            for (var j = 0; j < this.state.roles.length; j++) {
                if (this.state.roles[j].name == this.state.userRoles[i]) {
                    arrSelectedRoles.push(this.state.roles[j].id)
                }
            }
        }
        console.log(arrSelectedRoles)
        this.setState({ selectedRoles: arrSelectedRoles })
        console.log(this.state)
    }
compareRoles ( ) { let arrSelectedRoles = [ ] for ( var i = 0 ; i < this . state . userRoles . length ; i ++ ) { for ( var j = 0 ; j < this . state . roles . length ; j ++ ) { if ( this . state . roles [ j ] . name == this . state . userRoles [ i ] ) { arrSelectedRoles . push ( this . state . roles [ j ] . id ) } } } console . log ( arrSelectedRoles ) this . setState ( { selectedRoles : arrSelectedRoles } ) console . log ( this . state ) }
compare user's roles to list of roles to get the id of the selected roles()
and use them to update the selectedRoles state which highlight the selected
roles in the dropdown list
compare user ' s roles to list of roles to get the id of the selected roles () and use them to update the selectedRoles state which highlight the selected roles in the dropdown list