Closed lstellway closed 2 years ago
The latest updates on your projects. Learn more about Vercel for Git ↗︎
Name | Status | Preview | Updated |
---|---|---|---|
kratos-reference-ui-react-nextjs | ✅ Ready (Inspect) | Visit Preview | May 5, 2022 at 7:17PM (UTC) |
Thank you! I think from a code perspective this is really good! I think though that we want to keep it verbose because the app is intended to have a learning effect on readers. I think it is best if the code is very clear and visible without being spread across files, to give the reader an easy time navigating it. I think moving the shared logic into a file could make this a bit more difficult to understand. What do you think?
Apoligies for the delay (I've been out of town).
The structure I proposed comes from what I am accustom to: the "fat model, skinny controller" approach from the MVC design pattern. Also was trying to get rid of some repetitive logic, specifically with error handling (thinking about "DRY" / "don't repeat yourself").
I suppose it does make sense to keep things verbose and in context for the sake of learning. Everybody is different, but I found it easier to understand with the bulk of the logic in one place.
Thanks for the time / consideration!
No problem! I absolutely agree, DRY code is better, your solution is too. We use the code in a couple of places though (eg docs) and its very useful to have all the logic in that file. But again, in a real app, this should be cleaned up!
Description
While following this NextJS example and implementing my own frontend, I saw the same pattern was used for all of the user flows (get or initialize the flow based on the router query).
I thought it could be nice to abstract it outside of the view into a helper - let me know what you think!