2021-03-11 00:42:31 +00:00
|
|
|
|
2021-01-29 16:57:52 +00:00
|
|
|
|
|
|
|
fn main() {
|
2021-02-03 19:07:07 +00:00
|
|
|
// let mut s = Context { props: &() };
|
|
|
|
// let g = Component(&mut s);
|
2021-01-29 16:57:52 +00:00
|
|
|
}
|
|
|
|
|
2021-02-03 19:07:07 +00:00
|
|
|
// struct CompState {
|
|
|
|
// tasks: Vec<()>,
|
|
|
|
// }
|
|
|
|
// enum Actions {
|
|
|
|
// Add,
|
|
|
|
// MoveUp,
|
|
|
|
// MoveDown,
|
|
|
|
// Remvoe,
|
|
|
|
// }
|
2021-01-29 16:57:52 +00:00
|
|
|
|
2021-02-03 19:07:07 +00:00
|
|
|
// static Component: FC<()> = |ctx| {
|
|
|
|
// let (tasks, dispatch) = use_reducer(
|
|
|
|
// ctx,
|
|
|
|
// || CompState { tasks: Vec::new() },
|
|
|
|
// |state, action: Actions| match action {
|
|
|
|
// Actions::Add => state,
|
|
|
|
// Actions::MoveUp => state,
|
|
|
|
// Actions::MoveDown => state,
|
|
|
|
// Actions::Remvoe => state,
|
|
|
|
// },
|
|
|
|
// );
|
2021-01-29 16:57:52 +00:00
|
|
|
|
2021-02-03 19:07:07 +00:00
|
|
|
// let tasklist = { (0..10).map(|f| html! { <li></li> }) }.collect::<Vec<_>>();
|
2021-01-29 16:57:52 +00:00
|
|
|
|
2021-02-03 19:07:07 +00:00
|
|
|
// html! {
|
|
|
|
// <div>
|
|
|
|
// <div>
|
|
|
|
// <h1>"Tasks: "</h1>
|
|
|
|
// <ul>
|
|
|
|
// {tasklist}
|
|
|
|
// </ul>
|
|
|
|
// </div>
|
|
|
|
// <div>
|
|
|
|
// <button onclick=|_| dispatch(Action::Add)>{"Add"}</button>
|
|
|
|
// <button onclick=|_| dispatch(Action::MoveUp)>{"MoveUp"}</button>
|
|
|
|
// <button onclick=|_| dispatch(Action::MoveDown)>{"MoveDown"}</button>
|
|
|
|
// <button onclick=|_| dispatch(Action::Remvoe)>{"Remvoe"}</button>
|
|
|
|
// </div>
|
|
|
|
// </div>
|
|
|
|
// }
|
|
|
|
// };
|
2021-01-29 16:57:52 +00:00
|
|
|
|
2021-02-03 19:07:07 +00:00
|
|
|
// fn use_reducer<Props, State, Action>(
|
|
|
|
// ctx: &mut Context<Props>,
|
|
|
|
// init: fn() -> State,
|
|
|
|
// reducer: fn(State, Action) -> State,
|
|
|
|
// ) -> (State, impl Fn(Action)) {
|
|
|
|
// let ii = init();
|
|
|
|
// (ii, |_| {})
|
|
|
|
// }
|