Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

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

Comments

@peterschriever
Copy link

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;
image

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?

@rajeev-k-tomy
Copy link
Collaborator

@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.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants