# RuntimeContext

React context to share a FireflyRuntime instance between an host application and the modules.

# Reference

<RuntimeContext.Provider value={runtime}>
    <App />
</RuntimeContext.Provider>

# Properties

  • value: A FireflyRuntime instance.

# Usage

# Provide a runtime instance

import { createRoot } from "react-dom/client";
import { FireflyRuntime, RuntimeContext } from "@squide/firefly";

const runtime = new FireflyRuntime();

const root = createRoot(document.getElementById("root"));

root.render(
    <RuntimeContext.Provider value={runtime}>
        <App />
    </RuntimeContext.Provider>
);

# Retrieve a runtime instance

import { useRuntime } from "@squide/firefly";

const runtime = useRuntime();

runtime.logger.debug("Hello!");