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

Complex forms #34

Open
baransu opened this issue Oct 2, 2018 · 1 comment
Open

Complex forms #34

baransu opened this issue Oct 2, 2018 · 1 comment

Comments

@baransu
Copy link

baransu commented Oct 2, 2018

I'm trying to migrate plain reducer component that handles updates/validation of my form to re-formality. My form is complex and I'm having a hard time thinking about correct values/fields/updaters. Here is a type of the state:

type state = {
  name: string,
  parts: list(part)
}
and part = {
  image: string,
  title: string,
  subtitle: string,
  buttons: list(button),
}
and button =
  | UrlButton(url)
  | PluginButton(plugin)
and url = {
  id: string,
  caption: string,
  url: string,
}
and plugin = {
  caption: string,
  pluginId: string,
  instanceId: string,
};

For me, it's a really hard example. I want to have all functionality (like validation) available for even most nested values. Current API allows you to manage "one level deep" state really good but more complex state would require a lot of duplicated logic to update nested fields, a lot of fields, values etc.

Do you have any ideas on how we can improve re-formality API to better handle cases like this or how to approach this in application code using current API?

@alex35mil
Copy link
Member

This is somewhat similar to #29 and I haven't looked into complex examples yet. Can't promise anything concrete but I'll look into forms w/ complex structure sooner or later.

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

No branches or pull requests

2 participants