depreciate the render macro

This commit is contained in:
Evan Almloff committed 2024-01-16 13:18:46 -06:00
1 parent 90d0164b9e
commit e65c5f0eb3
148 files changed
+459 -458

No files matched your search

+7 -7
View File
@@ -18,7 +18,7 @@ This crate is a part of the broader Dioxus ecosystem. For more resources about D
Dioxus SSR provides utilities to render Dioxus components to valid HTML. Once rendered, the HTML can be rehydrated client-side or served from your web server of choice.
```rust, ignore
let app: Component = |cx| render!(div {"hello world!"});
let app: Component = |cx| rsx!(div {"hello world!"});
let mut vdom = VirtualDom::new(app);
let _ = vdom.rebuild();
@@ -29,12 +29,12 @@ assert_eq!(text, "<div>hello world!</div>")
## Basic Usage
The simplest example is to simply render some `render!` nodes to HTML. This can be done with the [`render_element`] API.
The simplest example is to simply render some `rsx!` nodes to HTML. This can be done with the [`render_element`] API.
```rust, ignore
let content = dioxus_ssr::render_element(render!{
let content = dioxus_ssr::render_element(rsx!{
div {
(0..5).map(|i| render!(
(0..5).map(|i| rsx!(
"Number: {i}"
))
}
@@ -84,10 +84,10 @@ The rest of the space - IE doing this more efficiently, caching the VirtualDom,
## Usage without a VirtualDom
Dioxus SSR needs an arena to allocate from - whether it be the VirtualDom or a dedicated Bump allocator. To render `render!` directly to a string, you'll want to create a `Renderer` and call `render_element`.
Dioxus SSR needs an arena to allocate from - whether it be the VirtualDom or a dedicated Bump allocator. To render `rsx!` directly to a string, you'll want to create a `Renderer` and call `render_element`.
```rust, ignore
let text = dioxus_ssr::Renderer::new().render_element(render!{
let text = dioxus_ssr::Renderer::new().render_element(rsx!{
div { "hello world" }
});
assert_eq!(text, "<div>hello world!</div>")
@@ -96,7 +96,7 @@ assert_eq!(text, "<div>hello world!</div>")
This can be automated with the `render_element!` macro:
```rust, ignore
let text = render_element!(render!( div { "hello world" } ));
let text = render_element!(rsx!( div { "hello world" } ));
```
## Usage in static site generation