(app: Component, props: P) -> VirtualDom {
/// In debug, this should also toss a warning.
#[test]
fn test_early_abort() {
- const app: Component<()> = |cx| {
+ const app: Component = |cx| {
let val = cx.use_hook(|_| 0, |f| f);
*val += 1;
diff --git a/packages/core/tests/lifecycle.rs b/packages/core/tests/lifecycle.rs
index dd8c66627..f87a403c7 100644
--- a/packages/core/tests/lifecycle.rs
+++ b/packages/core/tests/lifecycle.rs
@@ -45,7 +45,7 @@ fn manual_diffing() {
#[test]
fn events_generate() {
- static App: Component<()> = |cx| {
+ static App: Component = |cx| {
let count = cx.use_hook(|_| 0, |f| f);
let inner = match *count {
@@ -104,7 +104,7 @@ fn events_generate() {
#[test]
fn components_generate() {
- static App: Component<()> = |cx| {
+ static App: Component = |cx| {
let render_phase = cx.use_hook(|_| 0, |f| f);
*render_phase += 1;
@@ -121,7 +121,7 @@ fn components_generate() {
})
};
- static Child: Component<()> = |cx| {
+ static Child: Component = |cx| {
cx.render(rsx! {
h1 {}
})
@@ -220,7 +220,7 @@ fn components_generate() {
#[test]
fn component_swap() {
- static App: Component<()> = |cx| {
+ static App: Component = |cx| {
let render_phase = cx.use_hook(|_| 0, |f| f);
*render_phase += 1;
@@ -259,7 +259,7 @@ fn component_swap() {
})
};
- static NavBar: Component<()> = |cx| {
+ static NavBar: Component = |cx| {
println!("running navbar");
cx.render(rsx! {
h1 {
@@ -269,7 +269,7 @@ fn component_swap() {
})
};
- static NavLink: Component<()> = |cx| {
+ static NavLink: Component = |cx| {
println!("running navlink");
cx.render(rsx! {
h1 {
@@ -278,7 +278,7 @@ fn component_swap() {
})
};
- static Dashboard: Component<()> = |cx| {
+ static Dashboard: Component = |cx| {
println!("running dashboard");
cx.render(rsx! {
div {
@@ -287,7 +287,7 @@ fn component_swap() {
})
};
- static Results: Component<()> = |cx| {
+ static Results: Component = |cx| {
println!("running results");
cx.render(rsx! {
div {
diff --git a/packages/core/tests/sharedstate.rs b/packages/core/tests/sharedstate.rs
index 51b93a0e5..3f04aa154 100644
--- a/packages/core/tests/sharedstate.rs
+++ b/packages/core/tests/sharedstate.rs
@@ -13,12 +13,12 @@ mod test_logging;
fn shared_state_test() {
struct MySharedState(&'static str);
- static App: Component<()> = |cx| {
+ static App: Component = |cx| {
cx.provide_context(MySharedState("world!"));
cx.render(rsx!(Child {}))
};
- static Child: Component<()> = |cx| {
+ static Child: Component = |cx| {
let shared = cx.consume_context::()?;
cx.render(rsx!("Hello, {shared.0}"))
};
diff --git a/packages/core/tests/vdom_rebuild.rs b/packages/core/tests/vdom_rebuild.rs
index b4da2418e..21619d9c2 100644
--- a/packages/core/tests/vdom_rebuild.rs
+++ b/packages/core/tests/vdom_rebuild.rs
@@ -19,7 +19,7 @@ use DomEdit::*;
#[test]
fn app_runs() {
- static App: Component<()> = |cx| rsx!(cx, div{"hello"} );
+ static App: Component = |cx| rsx!(cx, div{"hello"} );
let mut vdom = VirtualDom::new(App);
let edits = vdom.rebuild();
@@ -27,7 +27,7 @@ fn app_runs() {
#[test]
fn fragments_work() {
- static App: Component<()> = |cx| {
+ static App: Component = |cx| {
cx.render(rsx!(
div{"hello"}
div{"goodbye"}
@@ -41,7 +41,7 @@ fn fragments_work() {
#[test]
fn lists_work() {
- static App: Component<()> = |cx| {
+ static App: Component = |cx| {
cx.render(rsx!(
h1 {"hello"}
{(0..6).map(|f| rsx!(span{ "{f}" }))}
@@ -54,7 +54,7 @@ fn lists_work() {
#[test]
fn conditional_rendering() {
- static App: Component<()> = |cx| {
+ static App: Component = |cx| {
cx.render(rsx!(
h1 {"hello"}
{true.then(|| rsx!(span{ "a" }))}
@@ -87,13 +87,13 @@ fn conditional_rendering() {
#[test]
fn child_components() {
- static App: Component<()> = |cx| {
+ static App: Component = |cx| {
cx.render(rsx!(
{true.then(|| rsx!(Child { }))}
{false.then(|| rsx!(Child { }))}
))
};
- static Child: Component<()> = |cx| {
+ static Child: Component = |cx| {
cx.render(rsx!(
h1 {"hello"}
h1 {"goodbye"}
diff --git a/packages/coroutines/Cargo.toml b/packages/coroutines/Cargo.toml
deleted file mode 100644
index 3b6e47851..000000000
--- a/packages/coroutines/Cargo.toml
+++ /dev/null
@@ -1,11 +0,0 @@
-[package]
-name = "dioxus-coroutines"
-version = "0.0.0"
-edition = "2018"
-repository = "https://github.com/DioxusLabs/dioxus/"
-homepage = "https://dioxuslabs.com"
-documentation = "https://dioxuslabs.com"
-keywords = ["dom", "ui", "gui", "react", "wasm"]
-# See more keys and their definitions at https://doc.rust-lang.org/cargo/reference/manifest.html
-
-[dependencies]
diff --git a/packages/coroutines/src/lib.rs b/packages/coroutines/src/lib.rs
deleted file mode 100644
index 1b4a90c93..000000000
--- a/packages/coroutines/src/lib.rs
+++ /dev/null
@@ -1,8 +0,0 @@
-#[cfg(test)]
-mod tests {
- #[test]
- fn it_works() {
- let result = 2 + 2;
- assert_eq!(result, 4);
- }
-}
diff --git a/packages/desktop/README.md b/packages/desktop/README.md
index 18225ade7..cfee902ed 100644
--- a/packages/desktop/README.md
+++ b/packages/desktop/README.md
@@ -7,7 +7,7 @@ fn main() {
dioxus::desktop::launch(App)
}
-static App: Component<()> = |cx| {
+static App: Component = |cx| {
let (count, set_count) = use_state(&cx, || 0);
cx.render(rsx!(
@@ -34,7 +34,7 @@ Window management, system trays, notifications, and other desktop-related functi
Managing windows is done by simply rendering content into a `WebviewWindow` component.
```rust
-static App: Component<()> = |cx| {
+static App: Component = |cx| {
rsx!(cx, WebviewWindow { "hello world" } )
}
```
@@ -46,7 +46,7 @@ Notifications also use a declarative approach. Sending a notification has never
The api has been somewhat modeled after https://github.com/mikaelbr/node-notifier
```rust
-static Notifications: Component<()> = |cx| {
+static Notifications: Component = |cx| {
cx.render(rsx!(
Notification {
title: "title"
@@ -78,7 +78,7 @@ static Notifications: Component<()> = |cx| {
Dioxus Desktop supports app trays, which can be built with native menu groups or with a custom window.
```rust
-static Tray: Component<()> = |cx| {
+static Tray: Component = |cx| {
cx.render(rsx!(
GlobalTray {
MenuGroup {
@@ -90,7 +90,7 @@ static Tray: Component<()> = |cx| {
};
// using a builder
-static Tray: Component<()> = |cx| {
+static Tray: Component = |cx| {
let menu = MenuGroup::builder(cx)
.with_items([
MenuGroupItem::builder()
@@ -107,7 +107,7 @@ static Tray: Component<()> = |cx| {
}
// or with a custom window
-static Tray: Component<()> = |cx| {
+static Tray: Component = |cx| {
rsx!(cx, GlobalTray { div { "custom buttons here" } })
};
```
@@ -116,7 +116,7 @@ static Tray: Component<()> = |cx| {
Declaring menus is convenient and cross-platform.
```rust
-static Menu: Component<()> = |cx| {
+static Menu: Component = |cx| {
cx.render(rsx!(
MenuBarMajorItem { title: "File"
MenuGroup {
diff --git a/packages/desktop/src/desktop_context.rs b/packages/desktop/src/desktop_context.rs
index 9a0607218..c1eae3613 100644
--- a/packages/desktop/src/desktop_context.rs
+++ b/packages/desktop/src/desktop_context.rs
@@ -56,7 +56,7 @@ pub struct WebviewWindowProps<'a> {
///
///
///
-pub fn WebviewWindow(cx: Context, props: &WebviewWindowProps) -> Element {
+pub fn WebviewWindow(cx: Scope) -> Element {
let dtcx = cx.consume_state::>()?;
cx.use_hook(
@@ -78,7 +78,7 @@ pub fn WebviewWindow(cx: Context, props: &WebviewWindowProps) -> Element {
pub struct WindowHandle {}
/// Get a handle to the current window from inside a component
-pub fn use_current_window(cx: Context) -> Option {
+pub fn use_current_window(cx: Scope) -> Option {
todo!()
}
@@ -90,7 +90,7 @@ fn syntax_works() {
use dioxus_hooks::*;
use dioxus_html as dioxus_elements;
- static App: Component<()> = |cx| {
+ static App: Component = |cx| {
cx.render(rsx! {
// left window
WebviewWindow {
diff --git a/packages/desktop/src/lib.rs b/packages/desktop/src/lib.rs
index 246360fad..523c6fa0d 100644
--- a/packages/desktop/src/lib.rs
+++ b/packages/desktop/src/lib.rs
@@ -28,11 +28,11 @@ use wry::{
webview::{WebView, WebViewBuilder},
};
-pub fn launch(root: Component<()>) {
+pub fn launch(root: Component) {
launch_with_props(root, (), |c| c)
}
pub fn launch_cfg(
- root: Component<()>,
+ root: Component,
config_builder: impl for<'a, 'b> FnOnce(&'b mut DesktopConfig<'a>) -> &'b mut DesktopConfig<'a>,
) {
launch_with_props(root, (), config_builder)
diff --git a/packages/hooks/src/usecollection.rs b/packages/hooks/src/usecollection.rs
index 47005e57b..0eed35b31 100644
--- a/packages/hooks/src/usecollection.rs
+++ b/packages/hooks/src/usecollection.rs
@@ -36,7 +36,7 @@ uses the same memoization on top of the use_context API.
Here's a fully-functional todo app using the use_map API:
```rust
-static TodoList: Component<()> = |cx, props|{
+static TodoList: Component = |cx| {
let todos = use_map(cx, || HashMap::new());
let input = use_ref(|| None);
diff --git a/packages/hooks/src/usestate.rs b/packages/hooks/src/usestate.rs
index 03bcf9c4c..88caea82d 100644
--- a/packages/hooks/src/usestate.rs
+++ b/packages/hooks/src/usestate.rs
@@ -46,7 +46,7 @@ impl<'a, P, T> UseStateA<'a, T> for Scope<'a, P> {
/// Usage:
///
/// ```ignore
-/// const Example: Component<()> = |cx| {
+/// const Example: Component = |cx| {
/// let counter = use_state(&cx, || 0);
///
/// cx.render(rsx! {
diff --git a/packages/liveview/README.md b/packages/liveview/README.md
index 4a05d9f10..5bbd8b75a 100644
--- a/packages/liveview/README.md
+++ b/packages/liveview/README.md
@@ -39,7 +39,7 @@ async fn order_shoes(mut req: WebsocketRequest) -> Response {
dioxus::liveview::launch(App, stream).await;
}
-fn App(cx: Context, props: &()) -> Element {
+fn App(cx: Scope<()>) -> Element {
let mut count = use_state(&cx, || 0);
cx.render(rsx!(
button { onclick: move |_| count += 1, "Incr" }
diff --git a/packages/mobile/src/lib.rs b/packages/mobile/src/lib.rs
index e11765dda..938d4e957 100644
--- a/packages/mobile/src/lib.rs
+++ b/packages/mobile/src/lib.rs
@@ -26,10 +26,7 @@ fn init_logging() {
static HTML_CONTENT: &'static str = include_str!("../../desktop/src/index.html");
-pub fn launch(
- root: Component<()>,
- builder: fn(WindowBuilder) -> WindowBuilder,
-) -> anyhow::Result<()> {
+pub fn launch(root: Component, builder: fn(WindowBuilder) -> WindowBuilder) -> anyhow::Result<()> {
launch_with_props(root, (), builder)
}
pub fn launch_with_props(
diff --git a/packages/router/README.md b/packages/router/README.md
index 05181ec9b..4cfa98c9d 100644
--- a/packages/router/README.md
+++ b/packages/router/README.md
@@ -16,7 +16,7 @@ enum AppRoute {
NotFound
}
-static App: Component<()> = |cx| {
+static App: Component = |cx| {
let route = use_router(cx, AppRoute::parse);
match route {
@@ -30,7 +30,7 @@ static App: Component<()> = |cx| {
Adding links into your app:
```rust
-static Leaf: Component<()> = |cx| {
+static Leaf: Component = |cx| {
rsx!(cx, div {
Link { to: AppRoute::Home }
})
diff --git a/packages/router/examples/simple.rs b/packages/router/examples/simple.rs
index eb5e7477f..134237dbb 100644
--- a/packages/router/examples/simple.rs
+++ b/packages/router/examples/simple.rs
@@ -10,7 +10,7 @@ fn main() {
dioxus_web::launch(APP);
}
-static APP: Component<()> = |cx| {
+static APP: Component = |cx| {
#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)]
enum Route {
Home,
diff --git a/packages/ssr/README.md b/packages/ssr/README.md
index 02f6e09d8..59bf28baa 100644
--- a/packages/ssr/README.md
+++ b/packages/ssr/README.md
@@ -5,7 +5,7 @@ Render a Dioxus VirtualDOM to a string.
```rust
// Our app:
-const App: Component<()> = |cx, props| rsx!(cx, div {"hello world!"});
+const App: Component = |cx| rsx!(cx, div {"hello world!"});
// Build the virtualdom from our app
let mut vdom = VirtualDOM::new(App);
diff --git a/packages/ssr/src/lib.rs b/packages/ssr/src/lib.rs
index 075ef0908..23e93084f 100644
--- a/packages/ssr/src/lib.rs
+++ b/packages/ssr/src/lib.rs
@@ -31,7 +31,7 @@ impl SsrRenderer {
}
}
- pub fn render_lazy<'a>(&'a mut self, f: Option>) -> String {
+ pub fn render_lazy<'a>(&'a mut self, f: LazyNodes<'a, '_>) -> String {
let bump = &mut self.inner as *mut _;
let s = self.render_inner(f);
// reuse the bump's memory
@@ -39,7 +39,7 @@ impl SsrRenderer {
s
}
- fn render_inner<'a>(&'a self, f: Option>) -> String {
+ fn render_inner<'a>(&'a self, f: LazyNodes<'a, '_>) -> String {
let factory = NodeFactory::new(&self.inner);
let root = f.into_vnode(factory);
format!(
@@ -53,7 +53,7 @@ impl SsrRenderer {
}
}
-pub fn render_lazy<'a>(f: Option>) -> String {
+pub fn render_lazy<'a>(f: LazyNodes<'a, '_>) -> String {
let bump = bumpalo::Bump::new();
let borrowed = ≎
@@ -113,7 +113,7 @@ pub fn render_vdom_scope(vdom: &VirtualDom, scope: ScopeId) -> Option {
///
/// ## Example
/// ```ignore
-/// static App: Component<()> = |cx, props|cx.render(rsx!(div { "hello world" }));
+/// static App: Component = |cx| cx.render(rsx!(div { "hello world" }));
/// let mut vdom = VirtualDom::new(App);
/// vdom.rebuild();
///
@@ -301,13 +301,13 @@ mod tests {
use dioxus_core_macro::*;
use dioxus_html as dioxus_elements;
- static SIMPLE_APP: Component<()> = |cx| {
+ static SIMPLE_APP: Component = |cx| {
cx.render(rsx!(div {
"hello world!"
}))
};
- static SLIGHTLY_MORE_COMPLEX: Component<()> = |cx| {
+ static SLIGHTLY_MORE_COMPLEX: Component = |cx| {
cx.render(rsx! {
div {
title: "About W3Schools"
@@ -326,14 +326,14 @@ mod tests {
})
};
- static NESTED_APP: Component<()> = |cx| {
+ static NESTED_APP: Component = |cx| {
cx.render(rsx!(
div {
SIMPLE_APP {}
}
))
};
- static FRAGMENT_APP: Component<()> = |cx| {
+ static FRAGMENT_APP: Component = |cx| {
cx.render(rsx!(
div { "f1" }
div { "f2" }
@@ -389,7 +389,7 @@ mod tests {
#[test]
fn styles() {
- static STLYE_APP: Component<()> = |cx| {
+ static STLYE_APP: Component = |cx| {
cx.render(rsx! {
div { color: "blue", font_size: "46px" }
})
diff --git a/packages/web/examples/async.rs b/packages/web/examples/async.rs
index 91a5ac33c..c045ca5e4 100644
--- a/packages/web/examples/async.rs
+++ b/packages/web/examples/async.rs
@@ -14,7 +14,7 @@ fn main() {
dioxus_web::launch(App);
}
-static App: Component<()> = |cx| {
+static App: Component = |cx| {
let mut count = use_state(&cx, || 0);
cx.push_future(|| async move {
diff --git a/packages/web/examples/js_bench.rs b/packages/web/examples/js_bench.rs
index 0295ef983..d9ddc7e1c 100644
--- a/packages/web/examples/js_bench.rs
+++ b/packages/web/examples/js_bench.rs
@@ -106,7 +106,7 @@ impl Label {
}
}
-static App: Component<()> = |cx| {
+static App: Component = |cx| {
let mut items = use_ref(&cx, || vec![]);
let mut selected = use_state(&cx, || None);
@@ -219,24 +219,3 @@ static NOUNS: &[&str] = &[
"table", "chair", "house", "bbq", "desk", "car", "pony", "cookie", "sandwich", "burger",
"pizza", "mouse", "keyboard",
];
-
-// #[derive(PartialEq, Props)]
-// struct RowProps<'a> {
-// row_id: usize,
-// label: &'a Label,
-// }
-
-// fn Row(cx: Context, props: &RowProps) -> Element {
-// rsx!(cx, tr {
-// td { class:"col-md-1", "{cx.props.row_id}" }
-// td { class:"col-md-1", onclick: move |_| { /* run onselect */ }
-// a { class: "lbl", {cx.props.label.labels} }
-// }
-// td { class: "col-md-1"
-// a { class: "remove", onclick: move |_| {/* remove */}
-// span { class: "glyphicon glyphicon-remove remove" aria_hidden: "true" }
-// }
-// }
-// td { class: "col-md-6" }
-// })
-// }
diff --git a/packages/web/examples/simple.rs b/packages/web/examples/simple.rs
index ffb572314..d3f2f078b 100644
--- a/packages/web/examples/simple.rs
+++ b/packages/web/examples/simple.rs
@@ -13,7 +13,7 @@ fn main() {
dioxus_web::launch(App);
}
-static App: Component<()> = |cx| {
+static App: Component = |cx| {
let show = use_state(&cx, || true);
let inner = match *show {
diff --git a/packages/web/examples/suspense.rs b/packages/web/examples/suspense.rs
index 84c3b5f83..30a15a123 100644
--- a/packages/web/examples/suspense.rs
+++ b/packages/web/examples/suspense.rs
@@ -14,7 +14,7 @@ fn main() {
dioxus_web::launch(App);
}
-static App: Component<()> = |cx| {
+static App: Component = |cx| {
todo!("suspense is broken")
// let doggo = suspend(|| async move {
// #[derive(serde::Deserialize)]
diff --git a/packages/web/src/lib.rs b/packages/web/src/lib.rs
index 73c9465b6..251597d49 100644
--- a/packages/web/src/lib.rs
+++ b/packages/web/src/lib.rs
@@ -84,11 +84,11 @@ mod ric_raf;
/// dioxus_web::launch(App);
/// }
///
-/// static App: Component<()> = |cx| {
+/// static App: Component = |cx| {
/// rsx!(cx, div {"hello world"})
/// }
/// ```
-pub fn launch(root_component: Component<()>) {
+pub fn launch(root_component: Component) {
launch_with_props(root_component, (), |c| c);
}