Allow to append script with clientCacheVar to head element
vinks opened this issue · comments
Konstantin Vinogradov commented
If we process injectSSRHtml with <html>content</html>
, then the script with cache data will be appended outside DOM. Its better has option, for appending it to head of page.
Ryan commented
It makes sense, I'll do an enhancement these days.
Ryan commented
This requirement has been supported.
https://github.com/RyanRoll/react-use-api#arguments-of-injectssrhtml
injectSSRHtml(
context: ReactUseApi.CustomContext,
renderSSR?: () => string,
postProcess?: (ssrHtml: string, apiCacheScript: string) => string,
): string
We are able to customize the html returned from injectSSRHtml by postProcess
.
By default, injectSSRHtml returns ssrHtml + apiCacheScript
.