docs: big updates to the reference

This commit is contained in:
Jonathan Kelley committed 2021-07-16 16:11:25 -04:00
1 parent caf772cf24
commit 583fdfa561
57 files changed
+726 -247

No files matched your search

+1 -1
View File
@@ -25,7 +25,7 @@ fn main() {
#[derive(Debug)]
struct CustomContext([&'static str; 3]);
static Example: FC<()> = |cx| {
pub static Example: FC<()> = |cx| {
cx.use_create_context(|| CustomContext(["Jack", "Jill", "Bob"]));
cx.render(rsx! {
+1 -1
View File
@@ -13,7 +13,7 @@ fn main() {
wasm_bindgen_futures::spawn_local(WebsysRenderer::start(Example));
}
static Example: FC<()> = |cx| {
pub static Example: FC<()> = |cx| {
let nodes = (0..500).map(|f| rsx! (li {"div"}));
cx.render(rsx! {
div {
+2 -2
View File
@@ -14,7 +14,7 @@ fn main() {
}
// this is a component
static Example: FC<()> = |cx| {
pub static Example: FC<()> = |cx| {
let (event, set_event) = use_state_classic(cx, || None);
let handler = move |evt| {
@@ -50,7 +50,7 @@ struct ExampleProps {
name: String,
}
static Example2: FC<ExampleProps> = |cx| {
pub static Example2: FC<ExampleProps> = |cx| {
cx.render(rsx! {
div {
h1 {"hello {cx.name}"}
+1 -1
View File
@@ -37,7 +37,7 @@ static App: FC<()> = |cx| {
})
};
static Example: FC<()> = |cx| {
pub 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"
+1 -1
View File
@@ -9,7 +9,7 @@ fn main() {
wasm_bindgen_futures::spawn_local(WebsysRenderer::start(Example))
}
static Example: FC<()> = |cx| {
pub static Example: FC<()> = |cx| {
let (name, set_name) = use_state_classic(cx, || "...?");
log::debug!("Running component....");
+1 -1
View File
@@ -9,7 +9,7 @@ fn main() {
wasm_bindgen_futures::spawn_local(WebsysRenderer::start(Example))
}
static Example: FC<()> = |cx| {
pub static Example: FC<()> = |cx| {
let (name, set_name) = use_state_classic(cx, || "...?");
cx.render(rsx! {
section { class: "py-12 px-4 text-center"
+1 -1
View File
@@ -11,7 +11,7 @@ fn main() {
wasm_bindgen_futures::spawn_local(WebsysRenderer::start(Example));
}
static Example: FC<()> = |cx| {
pub static Example: FC<()> = |cx| {
cx.render(rsx! {
div {
span {
+1 -1
View File
@@ -27,7 +27,7 @@ struct ExampleProps {
initial_name: &'static str,
}
static Example: FC<ExampleProps> = |cx| {
pub static Example: FC<ExampleProps> = |cx| {
let name = use_state(cx, move || cx.initial_name);
cx.render(rsx! {