import redraw.{type Component} /// Root to display React DOM. \ /// [Documentation](https://react.dev/reference/react-dom/client/createRoot#createroot) pub type Root /// Let you create a root to display React components inside a browser DOM node. /// Contrarily to JavaScript, `create_root` returns a `Result` to avoid runtime /// error. Indeed, when the provided root does not exist in your HTML, `create_root` /// fails. You should never assume `create_root` will work out-of-the-box when /// you're building a library. Otherwise, you could assert the resulting /// value in your application. /// /// ```gleam /// import redraw/dom/client /// /// pub fn main() { /// let assert Ok(root) = client.create_root("app") /// client.render(root, app()) /// } /// ``` /// /// [Documentation](https://react.dev/reference/react-dom/client/createRoot) @external(javascript, "../../client.ffi.mjs", "createRoot") pub fn create_root(root: String) -> Result(Root, Nil) /// Let you display React components inside a browser DOM node whose HTML content /// was previously generated by `react-dom/server`. /// Contrarily to JavaScript, `hydrate_root` returns a `Result` to avoid runtime /// error. Indeed, when the provided root does not exist in your HTML, `hydrate_root` /// fails. You should never assume `hydrate_root` will work out-of-the-box when /// you're building a library. Otherwise, you could assert the resulting /// value in your application. /// /// ```gleam /// import redraw/dom/client /// /// pub fn main() { /// let assert Ok(root) = client.hydrate_root("app") /// } /// ``` /// /// [Documentation](https://react.dev/reference/react-dom/client/hydrateRoot) @external(javascript, "../../client.ffi.mjs", "hydrateRoot") pub fn hydrate_root(root: String, node: Component) -> Result(Root, Nil) /// Call `render(root)` to display a piece of JSX (“React node”) into the React /// root’s browser DOM node. \ /// [Documentation](https://react.dev/reference/react-dom/client/createRoot#root-render) @external(javascript, "../../client.ffi.mjs", "render") pub fn render(root: Root, child: Component) -> Nil