feat: mvoe away from compound context
This commit is contained in:
1 parent
bfdcb20437
commit
a2c7d17b05
103 files changed
+309
-293
No files matched your search
@@ -2,7 +2,7 @@ use dioxus_core::prelude::*;
|
||||
|
||||
fn main() {}
|
||||
|
||||
pub static Example: FC<()> = |cx| {
|
||||
pub static Example: FC<()> = |cx, props| {
|
||||
let list = (0..10).map(|_f| LazyNodes::new(move |_f| todo!()));
|
||||
|
||||
cx.render(LazyNodes::new(move |cx| {
|
||||
|
||||
@@ -2,7 +2,7 @@ use dioxus_core::prelude::*;
|
||||
|
||||
fn main() {}
|
||||
|
||||
const App: FC<()> = |cx| {
|
||||
const App: FC<()> = |cx, props| {
|
||||
// create a new future
|
||||
let _fut = cx.use_hook(
|
||||
|_| {
|
||||
@@ -20,7 +20,7 @@ const App: FC<()> = |cx| {
|
||||
todo!()
|
||||
};
|
||||
|
||||
const Task: FC<()> = |cx| {
|
||||
const Task: FC<()> = |cx, props| {
|
||||
let (_task, _res) = use_task(cx, || async { true });
|
||||
// task.pause();
|
||||
// task.restart();
|
||||
@@ -34,6 +34,6 @@ const Task: FC<()> = |cx| {
|
||||
todo!()
|
||||
};
|
||||
|
||||
fn use_mut<P, T>(_cx: Context<P>, _f: impl FnOnce() -> T) -> &mut T {
|
||||
fn use_mut<P, T>(_cx: Context, _f: impl FnOnce() -> T) -> &mut T {
|
||||
todo!()
|
||||
}
|
||||
@@ -20,7 +20,7 @@ struct ListItem {
|
||||
age: u32,
|
||||
}
|
||||
|
||||
fn app(cx: Context<AppProps>) -> DomTree {
|
||||
fn app<'a>(cx: Context<'a>, props: &AppProps) -> DomTree<'a> {
|
||||
// let (val, set_val) = use_state_classic(cx, || 0);
|
||||
|
||||
cx.render(LazyNodes::new(move |_nodecx| {
|
||||
@@ -56,7 +56,7 @@ struct ChildProps {
|
||||
item_handler: Rc<dyn Fn(i32)>,
|
||||
}
|
||||
|
||||
fn ChildItem<'a>(cx: Context<'a, ChildProps>) -> DomTree {
|
||||
fn ChildItem<'a>(cx: Context<'a>, props: &'a ChildProps) -> DomTree<'a> {
|
||||
cx.render(LazyNodes::new(move |__cx| todo!()))
|
||||
}
|
||||
|
||||
|
||||
@@ -6,7 +6,7 @@ struct SomeContext {
|
||||
}
|
||||
|
||||
#[allow(unused)]
|
||||
static Example: FC<()> = |cpt| {
|
||||
static Example: FC<()> = |cx, props| {
|
||||
todo!()
|
||||
|
||||
// let value = cx.use_context(|c: &SomeContext| c.items.last().unwrap());
|
||||
|
||||
@@ -2,7 +2,7 @@ use dioxus_core::prelude::*;
|
||||
|
||||
fn main() {}
|
||||
|
||||
fn app(cx: Context<()>) -> DomTree {
|
||||
fn app<'a>(cx: Context<'a>, props: &()) -> DomTree<'a> {
|
||||
let vak = use_suspense(
|
||||
cx,
|
||||
|| async {},
|
||||
|
||||
@@ -10,7 +10,7 @@ fn main() {
|
||||
assert!(g.edits.len() > 1);
|
||||
}
|
||||
|
||||
static App: FC<()> = |cx| {
|
||||
static App: FC<()> = |cx, props| {
|
||||
let mut rng = SmallRng::from_entropy();
|
||||
let rows = (0..10_000).map(|f| {
|
||||
let label = Label::new(&mut rng);
|
||||
@@ -35,12 +35,12 @@ struct RowProps {
|
||||
row_id: usize,
|
||||
label: Label,
|
||||
}
|
||||
fn Row<'a>(cx: Context<'a, RowProps>) -> DomTree {
|
||||
fn Row<'a>(cx: Context<'a>, props: &'a RowProps) -> DomTree<'a> {
|
||||
cx.render(rsx! {
|
||||
tr {
|
||||
td { class:"col-md-1", "{cx.row_id}" }
|
||||
td { class:"col-md-1", "{props.row_id}" }
|
||||
td { class:"col-md-1", onclick: move |_| { /* run onselect */ }
|
||||
a { class: "lbl", "{cx.label}" }
|
||||
a { class: "lbl", "{props.label}" }
|
||||
}
|
||||
td { class: "col-md-1"
|
||||
a { class: "remove", onclick: move |_| {/* remove */}
|
||||
|
||||
@@ -4,7 +4,7 @@ use dioxus_core::prelude::*;
|
||||
|
||||
#[async_std::main]
|
||||
async fn main() {
|
||||
static App: FC<()> = |cx| cx.render(LazyNodes::new(|f| f.text(format_args!("hello"))));
|
||||
static App: FC<()> = |cx, props|cx.render(LazyNodes::new(|f| f.text(format_args!("hello"))));
|
||||
|
||||
let mut dom = VirtualDom::new(App);
|
||||
|
||||
|
||||
Reference in new issue
Block a user