feat: mvoe away from compound context

This commit is contained in:
Jonathan Kelley committed 2021-09-21 13:42:52 -04:00
1 parent bfdcb20437
commit a2c7d17b05
103 files changed
+309 -293

No files matched your search

+2 -3
View File
@@ -22,7 +22,7 @@ pub struct TodoItem {
}
const STYLE: &str = include_str!("./_examples/todomvc/style.css");
const App: FC<()> = |cx| {
const App: FC<()> = |cx, props| {
let draft = use_state(cx, || "".to_string());
let todos = use_state(cx, || HashMap::<u32, Rc<TodoItem>>::new());
let filter = use_state(cx, || FilterState::All);
@@ -87,8 +87,7 @@ pub struct TodoEntryProps {
todo: std::rc::Rc<TodoItem>,
}
pub fn TodoEntry(cx: Context<TodoEntryProps>) -> DomTree {
let TodoEntryProps { todo } = *cx;
pub fn TodoEntry<'a>(cx: Context<'a>, TodoEntryProps { todo }: &'a TodoEntryProps) -> DomTree<'a> {
let is_editing = use_state(cx, || false);
let contents = "";