JSFiddle - React, Tailwind, and code Playground
HTML
<input id="numberTxt">
JavaScript
$('#numberTxt').on("paste",function(e) {
var $this = $(this);
setTimeout(function(){
var val = $this.val(),
regex = /^[\d]+$/;
if( regex.test(val) ){
$this.val( val );
}
else{
$this.val('');
}
alert(val);
},0);
});