JSFiddle - React, Tailwind, and code Playground
by Farzad YZ
HTML
<script src="https://unpkg.com/[email protected]/lodash.js"></script>
<div id="test"></div>
CSS
#test {
height: 200px;
background: #ccc;
width: 100%;
}
JavaScript
function handler() {
console.log("test");
}
const throttled = _.throttle(handler, 300)
const debounced = _.debounce(handler, 300)
document
.getElementById("test")
.addEventListener("mousemove", debounced)