class UserList extends Component{
        constructor() {
            super();
            this.state = {
                list: [],
            };
        }
        componentDidMount() {
            this.getList();
        }
        getList(){
            axios
            .get('/getList')
            .then(response => {
                if(response.data.status == 'success'){
                    this.setState({
                        list: response.data.list,
                    });
                    console.log(response);
                }
            })
            .catch(error => {
                if (error.response) {
                    console.log(error.response);
                  }
            });
        }
{/*I want to call this function with userid when remove button is pressed */}
        deleteUser(){ 
        }
        render(){
            if(!localStorage.getItem('name')){
                return( <Redirect to={'/login'} /> )
            }
            return (
                    <div id="wrapper">
                        <table className="table table-hover">
                            <thead>
                                <tr>
                                    <th>#No</th>
                                    <th>#Name</th>
                                    <th>#Delete</th>
                                </tr>
                            </thead>
                            <tbody>                                                        
                            {
                                this.state.list.map(function(item, i){
                                    return  <React.Fragment>
                                        <tr key={i}>
                                            <td>{item.id}</td>{/* **This is user id** */}
                                            <td>{item.name}</td>
                                            <td>
                                                <button type="button" onClick="deleteUser(item.id)" className="btn btn-danger btn-sm">Remove</button>
                                            </td>
                                        </tr>
                                    </React.Fragment>  
                                })
                            } 
                            </tbody>
                        </table>
                    </div>
            )
        }
    }
    export default UserList;
I am new to ReactJS. I am trying to pass userid to function with onClick event to Remove button. But unable to send userid and it shows error. How can I do it. Can anybody help me with this. 
I am trying to pass userid to function with onClick event to Remove button. But unable to send userid and it shows error. How can I do it. Can anybody help me with this.
I am trying to pass userid to function with onClick event to Remove button. But unable to send userid and it shows error. How can I do it. Can anybody help me with this.
 
     
     
    