I'm using rapscallion and am using helmet to render a title and meta description (see here):
<div id="app">${appRenderer}</div>
// ...
// Set title and meta description
${() => {
helmet = Helmet.renderStatic()
return ''
}}
appendToHead('${() => helmet.title.toString()}')
appendToHead('${() => helmet.meta.toString()}')
Now helmet needs to be instantiated after rendering the app, but since rapscallion throws an error when returning undefined from an expression* I'm just returning an empty string. This isn't really a big deal and the current solution works fine.
But, I thought it might be nice to allow expressions that evaluate to undefined, which would then just insert nothing. No idea if that's possible or even desirable, but it would allow me to omit the return ''.
*: throw new Error("Unknown value in template of type " + (typeof segment === "undefined" ? "undefined" : _typeof(segment)) + ": " + segment);