Source: https://stackoverflow.com/a/56456055 The main difference between both is : useState causes re-render, useRef does not.