@flightdev/ui-inferno
v1.1.0
Published
Inferno SSR adapter for Flight Framework
Downloads
70
Readme
@flightdev/ui-inferno
Inferno SSR adapter for Flight Framework. High-performance React-like library.
Table of Contents
Installation
npm install @flightdev/ui @flightdev/ui-infernoPeer dependencies:
npm install inferno inferno-server inferno-create-element inferno-hydrateQuick Start
import { defineUI } from '@flightdev/ui';
import { inferno } from '@flightdev/ui-inferno';
const ui = defineUI(inferno());
const result = await ui.adapter.renderToString({
component: App,
props: { count: 0 },
});
console.log(result.html);SSR Options
Configure the Inferno adapter with options:
import { inferno } from '@flightdev/ui-inferno';
const adapter = inferno({
// Options
});Hydration
Generate hydration scripts for client-side interactivity:
const result = await adapter.renderToString({
component: App,
props: { data },
});
const hydrationScript = adapter.getHydrationScript(result);
const html = `
<!DOCTYPE html>
<html>
<body>
<div id="app">${result.html}</div>
${hydrationScript}
</body>
</html>
`;Client Entry
import { hydrate } from 'inferno-hydrate';
import { createElement } from 'inferno-create-element';
import App from './App';
const container = document.getElementById('app');
const props = window.__FLIGHT_DATA__.props;
hydrate(createElement(App, props), container);API Reference
inferno(options?)
Create an Inferno adapter instance.
function inferno(options?: InfernoAdapterOptions): InfernoAdapter;InfernoAdapter
| Method | Description |
|--------|-------------|
| renderToString(component, context?) | Render to HTML string |
| getHydrationScript(result) | Generate hydration script |
| getClientEntry() | Get client entry code |
Capabilities
| Capability | Supported | |------------|-----------| | Streaming | No | | Partial Hydration | No | | Islands | No | | Resumable | No | | SSG | Yes | | CSR | Yes | | Server Components | No |
License
MIT
