JSFiddle - React, Tailwind, and code Playground

HTML

<script src="https://code.jquery.com/jquery-2.2.3.min.js"></script>
<button id='foo'>
foo
</button>

JavaScript

$(document).ready(function() {
	var bar = function (context) {
 		var self = $(this);
    context++;
    alert(context);
    $('#foo').click(function() {
    	bar(context);
    });
    
  }
	$('#foo').click(function() {
  	bar(1);
  });
});