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
@@ -4,7 +4,7 @@ fn main() {}
// use dioxus_core as dioxus;
// use dioxus_core::prelude::*;
// static Example: FC<()> = |cx| {
// pub static Example: FC<()> = |cx| {
// let list = (0..10).map(|f| LazyNodes::new(move |f| todo!()));
// cx.render(LazyNodes::new(move |cx| {
+1 -5
View File
@@ -5,12 +5,8 @@ struct SomeContext {
items: Vec<String>,
}
struct Props {
name: String,
}
#[allow(unused)]
static Example: FC<Props> = |cpt| {
static Example: FC<()> = |cpt| {
todo!()
// let value = cx.use_context(|c: &SomeContext| c.items.last().unwrap());
+13 -2
View File
@@ -321,7 +321,10 @@ Any function prefixed with "use" should not be called conditionally.
///
///
///
pub fn use_task<Out, Fut, Init>(&self, task_initializer: Init) -> (&TaskHandle, &Option<Out>)
pub fn use_task<Out, Fut, Init>(
self,
task_initializer: Init,
) -> (TaskHandle<'src>, &'src Option<Out>)
where
Out: 'static,
Fut: Future<Output = Out> + 'static,
@@ -363,7 +366,7 @@ Any function prefixed with "use" should not be called conditionally.
if let Some(val) = hook.task_dump.as_ref().borrow_mut().take() {
hook.value = Some(val);
}
(&TaskHandle { _p: PhantomData }, &hook.value)
(TaskHandle { _p: PhantomData }, &hook.value)
},
|_| {},
)
@@ -463,6 +466,14 @@ impl<'src, P> Context<'src, P> {
}
}
#[derive(Clone, Copy)]
pub struct TaskHandle<'src> {
_p: PhantomData<&'src ()>,
}
impl<'src> TaskHandle<'src> {
pub fn toggle(&self) {}
pub fn start(&self) {}
pub fn stop(&self) {}
pub fn restart(&self) {}
}
+1 -1
View File
@@ -266,7 +266,7 @@ impl<'a> NodeFactory<'a> {
}
}
pub fn virtual_child<P>(
pub fn component<P>(
&self,
component: FC<P>,
props: P,