who-owns-what
who-owns-what copied to clipboard
Make a function that abstracts our querySelector logic
In our DetailView component we use the document.querySelector()
function to scroll to the top of the wrapper div. This usage created some problems when we converted to typescript as we then needed to check for the existence of such a HTML element before calling .scrollTop
on it. @toolness suggested that we could actually make a helper function that repeats this logic in a more abstract way so we can use it around our codebase.
Roight, there is actually such a helper in @justfixnyc/util
actually! https://github.com/JustFixNYC/justfix-ts/blob/master/packages/util/get-html-element.ts