/// Executes the user-given function that renders the document `<head>`, returning a string to be interpolated manually. Reactivity
/// in this function will not take effect due to this string rendering. Note that this function will provide a translator context.
Executes the user-given function that renders the document ``, returning a string to be interpolated manually. Reactivity
in this function will not take effect due to this string rendering. Note that this function will provide a translator context.
Executes the user - given function that renders the document ` ` returning a string to be interpolated manually . Reactivity in this function will not take effect due to this string rendering . Note that this function will provide a translator context .
pub fn render_head_str(&self, props: Option<String>, translator: &Translator) -> String {
        sycamore::render_to_string(|| {
            view! {
                // We provide the translator through context, which avoids having to define a separate variable for every translation due to Sycamore's `template!` macro taking ownership with `move` closures
                ContextProvider(ContextProviderProps {
                    value: RenderCtx {
                        // This function renders to a string, so we're effectively always on the server
                        // It's also only ever run on the server
                        is_server: true,
                        translator: translator.clone(),
                        // The head string is rendered to a string, and so never has information about router or global state
                        router: RouterState::default(),
                        global_state: GlobalState::default()
                    },
                    children: || (self.head)(props)
                })
            }
        })
    }
pub fn render_head_str ( & self , props : Option < String > , translator : & Translator ) -> String { sycamore :: render_to_string ( | | { view ! { // We provide the translator through context, which avoids having to define a separate variable for every translation due to Sycamore's `template!` macro taking ownership with `move` closures ContextProvider ( ContextProviderProps { value RenderCtx { // This function renders to a string, so we're effectively always on the server // It's also only ever run on the server is_server true translator translator clone ( ) // The head string is rendered to a string, and so never has information about router or global state router RouterState default ( ) global_state GlobalState default ( ) } children ( self head ) ( props ) } ) } } ) }
Executes the user-given function that renders the document `<head>`, returning a string to be interpolated manually.
Executes the user - given function that renders the document ` <head > ` returning a string to be interpolated manually .
&self
props
Option<String>
translator
&Translator