When you want to use a ` inside a template literal, you need to escape it with \, otherwise it ends the literal. You have several places in your code where you've written `` inside a template literal without escaping it; this ends the literal and then tries to use it as the tag for a new one, thus the error that a string is not a function.