Hi everyone I have a template that I need to fill out values from the back end.
I am using lodash _.template for this purpose. I am getting the value headerValue from the back end and nothing gets rendered. BUT when I declare it like this:
let headerValue = 'Example'
everything is working correctly. So I am guessing it is a asynchronous problem, since it does not seem to me like the code has problems?
Also when I am console logging the value from the back end - the value is correct and it is not undefined.
Any Ideas? Thanks.
const Header = ({headerValue}) => {
const headerText = {
copy:"This is my header: ${headerValue}"
}
const compiledHeader = _.template(headerText.copy);
headerText.copy = compiledHeader({
headerValue
});
/*more unrelated code*/
}