I am writing a custom component in Visual Studio Code and would like to assign a string value to a property. However I need to break the string into multiple lines. But whenever I do that VSCode gives me a list of problems.
This is what I am trying to achieve:
You need to use backTick to include multi line String literals. This is a feature of ES6
https://developer.mozilla.org/en/docs/Web/JavaScript/Reference/Template_literals
You can break lines using +
concatening operator:
template: "<h1>" +
"</h1>"
Or ` backtick
template: `<h1>
</h1>`
Or \
backslash
template: "<h1>\
</h1>"
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With