import renderToString from 'preact-render-to-string'
import { App } from './App.jsx'
import { MetadataContext } from './hooks.jsx'

export function render(url) {
    const metadata = {}

    const html = renderToString(
        <MetadataContext.Provider value={metadata}>
            <App url={url} />
        </MetadataContext.Provider>
    )

    return { html, metadata }
}
