pub fn ReactApp(_: ReactAppProps) -> ElementExpand description
React application container — loads a React app from a folder asset + manifest.
Uses Dioxus’s folder asset feature to reference the entire React build output directory. The manifest describes which CSS/JS files to load (with their hashed filenames), so no renaming or copying is needed.
The component:
- Loads all stylesheets listed in the manifest
- Injects the IPC bridge script (if provided)
- Creates the mount point
<div>and loads all JS bundles
§Example
ⓘ
use dioxus::prelude::*;
use dioxus_react_integration::prelude::*;
use std::time::Duration;
const REACT_DIR: Asset = asset!("/assets/react");
fn app() -> Element {
let bridge = IpcBridge::builder()
.timeout(Duration::from_secs(30))
.build();
let manifest = ReactManifest::from_json(
include_str!("../assets/react/metadata.json")
).expect("invalid metadata.json");
rsx! {
ReactApp {
dir: REACT_DIR,
manifest: manifest,
bridge: bridge,
}
}
}§Props
For details, see the props struct definition.
dir:AssetFolder asset pointing to the React build output directory
manifest:ReactManifestBuild manifest with the hashed filenames
bridge:Option<crate::prelude::IpcBridge>Optional IPC bridge instance (generates and injects the bridge script)
mount_id:StringDOM element ID where React will mount (default: “root”)