Add Function Components Example#2088
Conversation
|
🙏 I'm sorry; I think the TodoMVC https://todomvc.com/ has a standard style to it - also I do want the todo examples to be 1 to 1 with the only difference being the struct style approach and the function component approach. I did just start up your version and I do quite like the style, always more of a dark theme person myself :) |
407b6d3 to
0863616
Compare
mc1098
left a comment
There was a problem hiding this comment.
A few changes suggested but its mostly polish and performance tips - the todo application works well 🎉 I like how its been broken up into smaller components and was nice to see the "pure" footer component.
I'm seeing a pattern with cloning the output of hooks here and I just want to touch upon it. So often when we are cloning something like the UseStateHandle we do so because we are sending it to a Callback that must live for some unknown period of time and therefore we want it to be 'static. There are times, like getting the completed count where you can borrow the UseReducerHandle (state variable in this case) for a known and short period of time to build up some separate result and in these cases you don't have to clone the handle - you borrow and use it and then give it back for the following code to use.
f1a4bf6 to
ac429d1
Compare
ac429d1 to
a46cbab
Compare
mc1098
left a comment
There was a problem hiding this comment.
A few more suggestions some of which are optional or just pointing out certain things :)
So nearly there and sorry it's been taking me a bit longer to review these changes because I'm playing with things and tweaking impls and thinking about whether there are changes yew could make to make this all smoother.
fb765c1 to
f3222e6
Compare
f3222e6 to
17b92fa
Compare
mc1098
left a comment
There was a problem hiding this comment.
Mostly minor touches now.
I want a comment to explain that custom hook, otherwise we are going to have to keep explaining it in Discord for new yew users. The custom hook adds a bit of complexity but IMO is worth it, as it demonstrates implementing a raw custom hook which is not trivial :)
Not sure if you've skimmed over this at all @siku2 but I think this is the final round of review before I give it the green light - do you have anything to add to this review?
| "examples/dyn_create_destroy_apps", | ||
| "examples/function_todomvc", | ||
| "examples/file_upload", |
c02c835 to
24e6747
Compare
mc1098
left a comment
There was a problem hiding this comment.
Expanding a bit on that comment but thats it.
…ook, fix cargo.toml
|
We made it 🎉 Sorry for being so picky at points, part of it was some exploring of the hooks and function component API on my part too :) Thank you for all the hard work ❤️ |
Description
Simple ToDo Web App using function components and hooks
Fixes #2072
Checklist
cargo make pr-flowTODO Before ready