wip: docs and router

This commit is contained in:
Jonathan Kelley committed 2021-11-19 00:49:04 -05:00
1 parent 8bf57dc21d
commit a5f05d73ac
50 files changed
+1263 -234

No files matched your search

+1 -1
View File
@@ -36,7 +36,7 @@ uses the same memoization on top of the use_context API.
Here's a fully-functional todo app using the use_map API:
```rust
static TodoList: FC<()> = |(cx, props)|{
static TodoList: FC<()> = |cx, props|{
let todos = use_map(cx, || HashMap::new());
let input = use_ref(|| None);
+5
View File
@@ -33,6 +33,11 @@ impl<'a, T> UseRef<'a, T> {
self.inner.value.borrow()
}
pub fn set(&self, new: T) {
*self.inner.value.borrow_mut() = new;
self.needs_update();
}
pub fn read_write(&self) -> (Ref<'_, T>, &Self) {
(self.read(), self)
}
+1 -1
View File
@@ -35,7 +35,7 @@ use std::{
///
/// Usage:
/// ```ignore
/// const Example: FC<()> = |(cx, props)|{
/// const Example: FC<()> = |cx, props|{
/// let counter = use_state(cx, || 0);
/// let increment = |_| counter += 1;
/// let decrement = |_| counter += 1;