JSFiddle - React, Tailwind, and code Playground

HTML

<div id="backtotop">Scroll to Top</div>
<div style="height: 1000px; font-size: 3em">Скролни надолу</div>

CSS

#backtotop {
	display : none;
	position : fixed;
	text-align : center;
    color: white;
    background: red;
	z-index	: 1000;
    font-size: 2em;
    bottom: 0%;
    right: 0%;
}

JavaScript

$(function() {
	$(window).scroll(function() {
		if($(this).scrollTop() != 0) {
			$('#backtotop').fadeIn();	
		} else {
			$('#backtotop').fadeOut();
		}
	});
 
	$('#backtotop').click(function() {
		$('body,html').animate({scrollTop:0},800);
	});	
});