chore: rename ctx to cx

This commit is contained in:
Jonathan Kelley committed 2021-06-25 21:15:33 -04:00
1 parent 23c14078bb
commit 81382e7044
99 files changed
+789 -664

No files matched your search

+8 -8
View File
@@ -13,8 +13,8 @@ fn main() {
wasm_bindgen_futures::spawn_local(WebsysRenderer::start(App));
}
static App: FC<()> = |ctx| {
ctx.render(rsx! {
static App: FC<()> = |cx| {
cx.render(rsx! {
div {
h1 {"hello"}
C1 {}
@@ -23,23 +23,23 @@ static App: FC<()> = |ctx| {
})
};
static C1: FC<()> = |ctx| {
ctx.render(rsx! {
static C1: FC<()> = |cx| {
cx.render(rsx! {
button {
"numba 1"
}
})
};
static C2: FC<()> = |ctx| {
ctx.render(rsx! {
static C2: FC<()> = |cx| {
cx.render(rsx! {
button {
"numba 2"
}
})
};
static DocExamples: FC<()> = |ctx| {
static DocExamples: FC<()> = |cx| {
//
let is_ready = false;
@@ -61,7 +61,7 @@ static DocExamples: FC<()> = |ctx| {
// }
// }
ctx.render(rsx! {
cx.render(rsx! {
div {
{ is_ready.then(|| rsx!{ h1 {"We are ready!"} }) }
}
+5 -5
View File
@@ -12,8 +12,8 @@ fn main() {
wasm_bindgen_futures::spawn_local(WebsysRenderer::start(App));
}
static App: FC<()> = |ctx| {
ctx.render(rsx! {
static App: FC<()> = |cx| {
cx.render(rsx! {
Calcier {
h2 {"abc 1"}
h2 {"abc 2"}
@@ -24,13 +24,13 @@ static App: FC<()> = |ctx| {
})
};
static Calcier: FC<()> = |ctx| {
ctx.render(rsx! {
static Calcier: FC<()> = |cx| {
cx.render(rsx! {
div {
h1 {
"abc 0"
}
{ctx.children()}
{cx.children()}
}
})
};
+7 -7
View File
@@ -24,10 +24,10 @@ fn main() {
#[derive(Debug)]
struct CustomContext([&'static str; 3]);
static Example: FC<()> = |ctx| {
ctx.use_create_context(|| CustomContext(["Jack", "Jill", "Bob"]));
static Example: FC<()> = |cx| {
cx.use_create_context(|| CustomContext(["Jack", "Jill", "Bob"]));
ctx.render(rsx! {
cx.render(rsx! {
div {
class: "py-12 px-4 text-center w-full max-w-2xl mx-auto"
span {
@@ -51,11 +51,11 @@ struct ButtonProps {
id: u8,
}
fn CustomButton(ctx: Context<ButtonProps>) -> VNode {
let names = ctx.use_context::<CustomContext>();
let name = names.0[ctx.id as usize];
fn CustomButton(cx: Context<ButtonProps>) -> VNode {
let names = cx.use_context::<CustomContext>();
let name = names.0[cx.id as usize];
ctx.render(rsx!{
cx.render(rsx!{
button {
class: "inline-block py-4 px-8 mr-6 leading-none text-white bg-indigo-600 hover:bg-indigo-900 font-semibold rounded shadow"
"{name}"
+10 -10
View File
@@ -10,10 +10,10 @@ fn main() {
wasm_bindgen_futures::spawn_local(WebsysRenderer::start(CustomA))
}
fn CustomA(ctx: Context<()>) -> VNode {
let (val, set_val) = use_state(&ctx, || "abcdef".to_string() as String);
fn CustomA(cx: Context<()>) -> VNode {
let (val, set_val) = use_state(&cx, || "abcdef".to_string() as String);
ctx.render(rsx! {
cx.render(rsx! {
div {
class: "m-8"
"CustomA {val}"
@@ -42,12 +42,12 @@ mod components {
val: String,
}
pub fn CustomB(ctx: Context<PropsB>) -> VNode {
let (first, last) = ctx.val.split_at(3);
ctx.render(rsx! {
pub fn CustomB(cx: Context<PropsB>) -> VNode {
let (first, last) = cx.val.split_at(3);
cx.render(rsx! {
div {
class: "m-8"
"CustomB {ctx.val}"
"CustomB {cx.val}"
CustomC {
val: first.to_string()
}
@@ -63,11 +63,11 @@ mod components {
val: String,
}
fn CustomC(ctx: Context<PropsC>) -> VNode {
ctx.render(rsx! {
fn CustomC(cx: Context<PropsC>) -> VNode {
cx.render(rsx! {
div {
class: "m-8"
"CustomC {ctx.val}"
"CustomC {cx.val}"
}
})
}
+6 -6
View File
@@ -7,8 +7,8 @@ fn main() {
wasm_bindgen_futures::spawn_local(WebsysRenderer::start(App))
}
fn App(ctx: Context<()>) -> VNode {
ctx.render(rsx! {
fn App(cx: Context<()>) -> VNode {
cx.render(rsx! {
main { class: "dark:bg-gray-800 bg-white relative h-screen"
NavBar {}
{(0..10).map(|f| rsx!(Landing { key: "{f}" }))}
@@ -16,8 +16,8 @@ fn App(ctx: Context<()>) -> VNode {
})
}
fn NavBar(ctx: Context<()>) -> VNode {
ctx.render(rsx!{
fn NavBar(cx: Context<()>) -> VNode {
cx.render(rsx!{
header { class: "h-24 sm:h-32 flex items-center z-30 w-full"
div { class: "container mx-auto px-6 flex items-center justify-between"
div { class: "uppercase text-gray-800 dark:text-white font-black text-3xl"
@@ -56,8 +56,8 @@ fn NavBar(ctx: Context<()>) -> VNode {
})
}
fn Landing(ctx: Context<()>) -> VNode {
ctx.render(rsx!{
fn Landing(cx: Context<()>) -> VNode {
cx.render(rsx!{
div { class: "bg-white dark:bg-gray-800 flex relative z-20 items-center"
div { class: "container mx-auto px-6 flex flex-col justify-between items-center relative py-8"
div { class: "flex flex-col"
+5 -5
View File
@@ -8,9 +8,9 @@ fn main() {
wasm_bindgen_futures::spawn_local(WebsysRenderer::start(App));
}
fn App(ctx: Context<()>) -> VNode {
let cansee = use_state_new(&ctx, || false);
rsx! { in ctx,
fn App(cx: Context<()>) -> VNode {
let cansee = use_state_new(&cx, || false);
rsx! { in cx,
div {
"Shadow of the child:"
button { onclick: move |_| cansee.set(!**cansee)
@@ -21,8 +21,8 @@ fn App(ctx: Context<()>) -> VNode {
}
}
fn Child(ctx: Context<()>) -> VNode {
rsx! { in ctx,
fn Child(cx: Context<()>) -> VNode {
rsx! { in cx,
section { class: "py-6 bg-coolGray-100 text-coolGray-900"
div { class: "container mx-auto flex flex-col items-center justify-center p-4 space-y-8 md:p-10 md:px-24 xl:px-48"
h1 { class: "text-5xl font-bold leading-none text-center",
+2 -2
View File
@@ -12,8 +12,8 @@ fn main() {
wasm_bindgen_futures::spawn_local(WebsysRenderer::start(App));
}
static App: FC<()> = |ctx| {
ctx.render(rsx! {
static App: FC<()> = |cx| {
cx.render(rsx! {
h2 { "abc 1" }
div {
"hello world!"
+2 -2
View File
@@ -10,9 +10,9 @@ fn main() {
wasm_bindgen_futures::spawn_local(WebsysRenderer::start(Example));
}
static Example: FC<()> = |ctx| {
static Example: FC<()> = |cx| {
let nodes = (0..15).map(|f| rsx! (li { key: "{f}", "{f}"}));
ctx.render(rsx! {
cx.render(rsx! {
div {
span {
class: "px-2 py-1 flex w-36 mt-4 items-center text-xs rounded-md font-semibold text-yellow-500 bg-yellow-100"
+2 -2
View File
@@ -5,8 +5,8 @@ fn main() {
wasm_bindgen_futures::spawn_local(dioxus_web::WebsysRenderer::start(App))
}
fn App(ctx: Context<()>) -> VNode {
ctx.render(rsx! {
fn App(cx: Context<()>) -> VNode {
cx.render(rsx! {
div { "Hello, world!" }
})
}
+6 -6
View File
@@ -12,8 +12,8 @@ fn main() {
}
// this is a component
static Example: FC<()> = |ctx| {
let (event, set_event) = use_state(&ctx, || None);
static Example: FC<()> = |cx| {
let (event, set_event) = use_state(&cx, || None);
let handler = move |evt| {
set_event(Some(evt));
@@ -21,7 +21,7 @@ static Example: FC<()> = |ctx| {
log::info!("hello world");
ctx.render(rsx! {
cx.render(rsx! {
div {
class: "py-12 px-4 w-full max-w-2xl mx-auto bg-red-100"
@@ -48,10 +48,10 @@ struct ExampleProps {
name: String,
}
static Example2: FC<ExampleProps> = |ctx| {
ctx.render(rsx! {
static Example2: FC<ExampleProps> = |cx| {
cx.render(rsx! {
div {
h1 {"hello {ctx.name}"}
h1 {"hello {cx.name}"}
}
})
};
+8 -8
View File
@@ -10,10 +10,10 @@ fn main() {
wasm_bindgen_futures::spawn_local(WebsysRenderer::start(App));
}
static App: FC<()> = |ctx| {
let (val, set_val) = use_state(&ctx, || "asd".to_string());
static App: FC<()> = |cx| {
let (val, set_val) = use_state(&cx, || "asd".to_string());
ctx.render(rsx! {
cx.render(rsx! {
div { class: "max-w-lg max-w-xs bg-blue-800 shadow-2xl rounded-lg mx-auto text-center py-12 mt-4 rounded-xl"
div { class: "container py-5 max-w-md mx-auto"
h1 { class: "text-gray-200 text-center font-extrabold -mt-3 text-3xl",
@@ -35,8 +35,8 @@ static App: FC<()> = |ctx| {
})
};
static Example: FC<()> = |ctx| {
ctx.render(rsx! {
static Example: FC<()> = |cx| {
cx.render(rsx! {
div { class: "max-w-lg max-w-xs bg-blue-800 shadow-2xl rounded-lg mx-auto text-center py-12 mt-4 rounded-xl"
div { class: "container py-5 max-w-md mx-auto"
h1 { class: "text-gray-200 text-center font-extrabold -mt-3 text-3xl",
@@ -48,10 +48,10 @@ static Example: FC<()> = |ctx| {
})
};
static UserInput: FC<()> = |ctx| {
let (val, set_val) = use_state(&ctx, || "asd".to_string());
static UserInput: FC<()> = |cx| {
let (val, set_val) = use_state(&cx, || "asd".to_string());
rsx! { in ctx,
rsx! { in cx,
div { class: "mb-4"
input { class: "shadow appearance-none rounded w-full py-2 px-3 text-gray-700 leading-tight focus:outline-none focus:shadow-outline"
placeholder: "Username"
+3 -3
View File
@@ -9,12 +9,12 @@ fn main() {
wasm_bindgen_futures::spawn_local(WebsysRenderer::start(Example))
}
static Example: FC<()> = |ctx| {
let (name, set_name) = use_state(&ctx, || "...?");
static Example: FC<()> = |cx| {
let (name, set_name) = use_state(&cx, || "...?");
log::debug!("Running component....");
ctx.render(html! {
cx.render(html! {
<div>
<section class="py-12 px-4 text-center">
<div class="w-full max-w-2xl mx-auto">
+3 -3
View File
@@ -12,10 +12,10 @@ fn main() {
wasm_bindgen_futures::spawn_local(WebsysRenderer::start(App));
}
static App: FC<()> = |ctx| {
let (contents, set_contents) = use_state(&ctx, || "asd");
static App: FC<()> = |cx| {
let (contents, set_contents) = use_state(&cx, || "asd");
ctx.render(rsx! {
cx.render(rsx! {
div {
class: "flex items-center justify-center flex-col"
div {
+3 -3
View File
@@ -13,10 +13,10 @@ fn main() {
wasm_bindgen_futures::spawn_local(WebsysRenderer::start(App));
}
static App: FC<()> = |ctx| {
let (contents, set_contents) = use_state(&ctx, || "asd");
static App: FC<()> = |cx| {
let (contents, set_contents) = use_state(&cx, || "asd");
ctx.render(rsx! {
cx.render(rsx! {
div { class: "flex items-center justify-center flex-col"
div { class: "flex items-center justify-center"
div { class: "flex flex-col bg-white rounded p-4 w-full max-w-xs"
+9 -9
View File
@@ -25,11 +25,11 @@ pub struct TodoItem {
pub contents: String,
}
static App: FC<()> = |ctx| {
let (draft, set_draft) = use_state(&ctx, || "".to_string());
let (filter, set_filter) = use_state(&ctx, || FilterState::All);
let todos = use_state_new(&ctx, || BTreeMap::<uuid::Uuid, TodoItem>::new());
ctx.render(rsx!(
static App: FC<()> = |cx| {
let (draft, set_draft) = use_state(&cx, || "".to_string());
let (filter, set_filter) = use_state(&cx, || FilterState::All);
let todos = use_state_new(&cx, || BTreeMap::<uuid::Uuid, TodoItem>::new());
cx.render(rsx!(
div {
id: "app"
div {
@@ -131,9 +131,9 @@ static App: FC<()> = |ctx| {
))
};
pub fn FilterToggles(ctx: Context<()>) -> VNode {
// let reducer = recoil::use_callback(&ctx, || ());
// let items_left = recoil::use_atom_family(&ctx, &TODOS, uuid::Uuid::new_v4());
pub fn FilterToggles(cx: Context<()>) -> VNode {
// let reducer = recoil::use_callback(&cx, || ());
// let items_left = recoil::use_atom_family(&cx, &TODOS, uuid::Uuid::new_v4());
let toggles = [
("All", "", FilterState::All),
@@ -158,7 +158,7 @@ pub fn FilterToggles(ctx: Context<()>) -> VNode {
let item_text = "";
let items_left = "";
ctx.render(rsx! {
cx.render(rsx! {
footer {
span {
strong {"{items_left}"}
+2 -2
View File
@@ -10,8 +10,8 @@ fn main() {
wasm_bindgen_futures::spawn_local(WebsysRenderer::start(Example));
}
static Example: FC<()> = |ctx| {
ctx.render(rsx! {
static Example: FC<()> = |cx| {
cx.render(rsx! {
div {
span {
class: "px-2 py-1 flex w-36 mt-4 items-center text-xs rounded-md font-semibold text-yellow-500 bg-yellow-100"
+3 -3
View File
@@ -5,10 +5,10 @@
// wasm_bindgen_futures::spawn_local(WebsysRenderer::start(Example));
// }
// fn Example(ctx: Context, props: ()) -> VNode {
// let user_data = use_sql_query(&ctx, USER_DATA_QUERY);
// fn Example(cx: Context, props: ()) -> VNode {
// let user_data = use_sql_query(&cx, USER_DATA_QUERY);
// ctx.render(rsx! {
// cx.render(rsx! {
// h1 { "Hello, {username}"}
// button {
// "Delete user"
+10 -10
View File
@@ -25,10 +25,10 @@ struct ExampleProps {
initial_name: &'static str,
}
static Example: FC<ExampleProps> = |ctx| {
let name = use_state_new(&ctx, move || ctx.initial_name);
static Example: FC<ExampleProps> = |cx| {
let name = use_state_new(&cx, move || cx.initial_name);
ctx.render(rsx! {
cx.render(rsx! {
div {
class: "py-12 px-4 text-center w-full max-w-2xl mx-auto"
span {
@@ -55,12 +55,12 @@ struct ButtonProps<'src, F: Fn(Rc<dyn MouseEvent>)> {
handler: F,
}
fn CustomButton<'a, F: Fn(MouseEvent)>(ctx: Context<'a, ButtonProps<'a, F>>) -> VNode {
ctx.render(rsx!{
fn CustomButton<'a, F: Fn(MouseEvent)>(cx: Context<'a, ButtonProps<'a, F>>) -> VNode {
cx.render(rsx!{
button {
class: "inline-block py-4 px-8 mr-6 leading-none text-white bg-indigo-600 hover:bg-indigo-900 font-semibold rounded shadow"
onmouseover: {&ctx.handler}
"{ctx.name}"
onmouseover: {&cx.handler}
"{cx.name}"
}
})
}
@@ -75,10 +75,10 @@ impl<F: Fn(MouseEvent)> PartialEq for ButtonProps<'_, F> {
struct PlaceholderProps {
val: &'static str,
}
fn Placeholder(ctx: Context<PlaceholderProps>) -> VNode {
ctx.render(rsx! {
fn Placeholder(cx: Context<PlaceholderProps>) -> VNode {
cx.render(rsx! {
div {
"child: {ctx.val}"
"child: {cx.val}"
}
})
}
@@ -2,9 +2,9 @@ use crate::recoil;
use crate::state::{FilterState, TODOS};
use dioxus_core::prelude::*;
pub fn FilterToggles(ctx: Context<()>) -> VNode {
let reducer = recoil::use_callback(&ctx, || ());
let items_left = recoil::use_atom_family(&ctx, &TODOS, uuid::Uuid::new_v4());
pub fn FilterToggles(cx: Context<()>) -> VNode {
let reducer = recoil::use_callback(&cx, || ());
let items_left = recoil::use_atom_family(&cx, &TODOS, uuid::Uuid::new_v4());
let toggles = [
("All", "", FilterState::All),
@@ -27,7 +27,7 @@ pub fn FilterToggles(ctx: Context<()>) -> VNode {
let item_text = "";
let items_left = "";
ctx.render(rsx! {
cx.render(rsx! {
footer {
span {
strong {"{items_left}"}
+2 -2
View File
@@ -10,8 +10,8 @@ use dioxus_web::{prelude::*, WebsysRenderer};
static APP_STYLE: &'static str = include_str!("./style.css");
fn main() {
wasm_bindgen_futures::spawn_local(WebsysRenderer::start(|ctx| {
ctx.render(rsx! {
wasm_bindgen_futures::spawn_local(WebsysRenderer::start(|cx| {
cx.render(rsx! {
div {
id: "app"
// style { "{APP_STYLE}" }
+2 -2
View File
@@ -33,10 +33,10 @@ impl RecoilContext<()> {
// let (set, get) = (self.set, self.get);
// TOODS
// .get(&ctx)
// .get(&cx)
// .iter()
// .filter(|(k, v)| v.checked)
// .map(|(k, v)| TODOS.remove(&ctx, k));
// .map(|(k, v)| TODOS.remove(&cx, k));
}
pub fn set_filter(&self, filter: &FilterState) {}
+4 -4
View File
@@ -7,11 +7,11 @@ pub struct TodoEntryProps {
id: uuid::Uuid,
}
pub fn TodoEntry(ctx: Context, props: &TodoEntryProps) -> VNode {
let (is_editing, set_is_editing) = use_state(&ctx, || false);
let todo = use_atom_family(&ctx, &TODOS, ctx.id);
pub fn TodoEntry(cx: Context, props: &TodoEntryProps) -> VNode {
let (is_editing, set_is_editing) = use_state(&cx, || false);
let todo = use_atom_family(&cx, &TODOS, cx.id);
ctx.render(rsx! (
cx.render(rsx! (
li {
"{todo.id}"
input {
+5 -5
View File
@@ -6,12 +6,12 @@ use crate::{
};
use dioxus_core::prelude::*;
pub fn TodoList(ctx: Context<()>) -> VNode {
let (draft, set_draft) = use_state(&ctx, || "".to_string());
let (todos, _) = use_state(&ctx, || Vec::<TodoItem>::new());
let filter = use_atom(&ctx, &FILTER);
pub fn TodoList(cx: Context<()>) -> VNode {
let (draft, set_draft) = use_state(&cx, || "".to_string());
let (todos, _) = use_state(&cx, || Vec::<TodoItem>::new());
let filter = use_atom(&cx, &FILTER);
ctx.render(rsx! {
cx.render(rsx! {
div {
header {
class: "header"
+12 -12
View File
@@ -27,8 +27,8 @@ pub struct TodoItem {
// =======================
// Components
// =======================
pub fn App(ctx: Context<()>) -> VNode {
ctx.render(rsx! {
pub fn App(cx: Context<()>) -> VNode {
cx.render(rsx! {
div {
id: "app"
@@ -52,12 +52,12 @@ pub fn App(ctx: Context<()>) -> VNode {
})
}
pub fn TodoList(ctx: Context<()>) -> VNode {
let (draft, set_draft) = use_state(&ctx, || "".to_string());
let (todos, set_todos) = use_state(&ctx, || HashMap::<uuid::Uuid, Rc<TodoItem>>::new());
let (filter, set_filter) = use_state(&ctx, || FilterState::All);
pub fn TodoList(cx: Context<()>) -> VNode {
let (draft, set_draft) = use_state(&cx, || "".to_string());
let (todos, set_todos) = use_state(&cx, || HashMap::<uuid::Uuid, Rc<TodoItem>>::new());
let (filter, set_filter) = use_state(&cx, || FilterState::All);
ctx.render(rsx! {
cx.render(rsx! {
div {
header {
class: "header"
@@ -101,8 +101,8 @@ pub struct TodoEntryProps {
item: Rc<TodoItem>,
}
pub fn TodoEntry(ctx: Context<TodoEntryProps>) -> VNode {
let (is_editing, set_is_editing) = use_state(&ctx, || false);
pub fn TodoEntry(cx: Context<TodoEntryProps>) -> VNode {
let (is_editing, set_is_editing) = use_state(&cx, || false);
let contents = "";
let todo = TodoItem {
checked: false,
@@ -110,7 +110,7 @@ pub fn TodoEntry(ctx: Context<TodoEntryProps>) -> VNode {
id: uuid::Uuid::new_v4(),
};
ctx.render(rsx! (
cx.render(rsx! (
li {
"{todo.id}"
input {
@@ -127,7 +127,7 @@ pub fn TodoEntry(ctx: Context<TodoEntryProps>) -> VNode {
))
}
pub fn FilterToggles(ctx: Context<()>) -> VNode {
pub fn FilterToggles(cx: Context<()>) -> VNode {
let toggles = [
("All", "", FilterState::All),
("Active", "active", FilterState::Active),
@@ -151,7 +151,7 @@ pub fn FilterToggles(ctx: Context<()>) -> VNode {
let item_text = "";
let items_left = "";
ctx.render(rsx! {
cx.render(rsx! {
footer {
span {
strong {"{items_left}"}
+18 -18
View File
@@ -72,10 +72,10 @@ impl TodoManager {
}
}
pub fn TodoList(ctx: Context<()>) -> VNode {
let draft = use_state_new(&ctx, || "".to_string());
let todos = use_read(&ctx, &TODO_LIST);
let filter = use_read(&ctx, &FILTER);
pub fn TodoList(cx: Context<()>) -> VNode {
let draft = use_state_new(&cx, || "".to_string());
let todos = use_read(&cx, &TODO_LIST);
let filter = use_read(&cx, &FILTER);
let todolist = todos
.values()
@@ -91,7 +91,7 @@ pub fn TodoList(ctx: Context<()>) -> VNode {
})
});
rsx! { in ctx,
rsx! { in cx,
div {
header {
class: "header"
@@ -116,11 +116,11 @@ pub struct TodoEntryProps {
id: Uuid,
}
pub fn TodoEntry(ctx: Context, props: &TodoEntryProps) -> VNode {
let (is_editing, set_is_editing) = use_state(&ctx, || false);
let todo = use_read(&ctx, &TODO_LIST).get(&ctx.id).unwrap();
pub fn TodoEntry(cx: Context, props: &TodoEntryProps) -> VNode {
let (is_editing, set_is_editing) = use_state(&cx, || false);
let todo = use_read(&cx, &TODO_LIST).get(&cx.id).unwrap();
ctx.render(rsx! (
cx.render(rsx! (
li {
"{todo.id}"
input {
@@ -137,9 +137,9 @@ pub fn TodoEntry(ctx: Context, props: &TodoEntryProps) -> VNode {
))
}
pub fn FilterToggles(ctx: Context<()>) -> VNode {
let reducer = TodoManager(use_recoil_api(ctx));
let items_left = use_read(ctx, &TODOS_LEFT);
pub fn FilterToggles(cx: Context<()>) -> VNode {
let reducer = TodoManager(use_recoil_api(cx));
let items_left = use_read(cx, &TODOS_LEFT);
let toggles = [
("All", "", FilterState::All),
@@ -164,7 +164,7 @@ pub fn FilterToggles(ctx: Context<()>) -> VNode {
_ => "items",
};
rsx! { in ctx,
rsx! { in cx,
footer {
span {
strong {"{items_left}"}
@@ -178,8 +178,8 @@ pub fn FilterToggles(ctx: Context<()>) -> VNode {
}
}
pub fn Footer(ctx: Context<()>) -> VNode {
rsx! { in ctx,
pub fn Footer(cx: Context<()>) -> VNode {
rsx! { in cx,
footer { class: "info"
p {"Double-click to edit a todo"}
p {
@@ -196,9 +196,9 @@ pub fn Footer(ctx: Context<()>) -> VNode {
const APP_STYLE: &'static str = include_str!("./todomvc/style.css");
fn App(ctx: Context<()>) -> VNode {
use_init_recoil_root(ctx, |_| {});
rsx! { in ctx,
fn App(cx: Context<()>) -> VNode {
use_init_recoil_root(cx, |_| {});
rsx! { in cx,
div { id: "app"
TodoList {}
Footer {}
+2 -2
View File
@@ -9,8 +9,8 @@ fn main() {
wasm_logger::init(wasm_logger::Config::new(log::Level::Debug));
console_error_panic_hook::set_once();
wasm_bindgen_futures::spawn_local(WebsysRenderer::start(|ctx| {
ctx.render(html! {
wasm_bindgen_futures::spawn_local(WebsysRenderer::start(|cx| {
cx.render(html! {
<div>
<div class="flex items-center justify-center flex-col">
<div class="flex items-center justify-center">