You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
The amount of effort and file creation required to extend the checkout with a new form component calls for some sort of template or code generation
#153
Open
peterschriever opened this issue
Aug 26, 2021
· 1 comment
Yesterday I added a form component for the subscription of newsletter emails during checkout process. For this simple component, existing of;
a single checkbox input
a graphql api call
and corresponding AppContext action method and reducer method
I could mostly copy over code from a previous project to implement the graphql api call and AppContext action & reducer methods, however I had to spend a lot of time on simply creating the React component filestructure and understanding existing components in terms of using Memorization, component level context, FormikProvider.. etc
I ended up with the following file structure for just the component with checkbox input and form wrapped around;
Now I have talked some with you (@progammer-rkt) & willem, and have viewed quite a lot of the existing components and understand that you are quite set on this file structure. But it takes a lot of effort and indicates much repetitive work to me, I am personally likely to just include a template component in my future projects. Perhaps more sophisticated would be some sort of code generation?
Thoughts on including this?
The text was updated successfully, but these errors were encountered:
@peterschriever Since this is an open-source project, I think sticking to a structure like this is very important. It is correct that steps are repetitive. But, once you understand how an individual form section works within the app, then it will be so easy to work with the app. The result would be a consistent and concise codebase which will be easily pickup by another developer who come across the codebase even though he/she is pretty much new to the app.
So, yes, templating the above makes sense to me. We can even keep this piece of code in a separate repo and then integrate into the app if needed too.
Yesterday I added a form component for the subscription of newsletter emails during checkout process. For this simple component, existing of;
I could mostly copy over code from a previous project to implement the graphql api call and AppContext action & reducer methods, however I had to spend a lot of time on simply creating the React component filestructure and understanding existing components in terms of using Memorization, component level context, FormikProvider.. etc
I ended up with the following file structure for just the component with checkbox input and form wrapped around;
![image](https://user-images.githubusercontent.com/6523141/130991333-6926d4fd-85d3-43b2-baaf-6f4ce87bd3ae.png)
Now I have talked some with you (@progammer-rkt) & willem, and have viewed quite a lot of the existing components and understand that you are quite set on this file structure. But it takes a lot of effort and indicates much repetitive work to me, I am personally likely to just include a template component in my future projects. Perhaps more sophisticated would be some sort of code generation?
Thoughts on including this?
The text was updated successfully, but these errors were encountered: