Skip to content

Make form-designer more reusable #6

Open

Description

@timwis

From IRC

[timwis] i'd love to build form-designer so that it can be dropped in to another application, like a component (even a non choo app). but the component/view itself is pretty useless without state, and expecting them to write their own reducers seems a bit much... do you anticipate encountering this with base-elements? an element that needs state to work, and is a bit much to BYO reducers? trying to imagine what the API could be ... ${FormDesigner(state.fields, onStateChange)} ? that could work if the component basically had its own reducers and sent the fully patched state up to the callback

[yoshuawuyts] it depends I'd say
06:22 I think reducers are an abstraction that's useful for applications
06:22 lots of different moving parts, and trying to add structure to logic
06:22 but components are different
06:23 if they got tightly knit logic that's part of it, make it part of the app and expose as little as possible to the outside world
06:23 probably mostly state persisting things, and async hooks if need be
06:23 like how we do form-element
06:24 I think BYO reducers might create unnecessary lockin to a certain model, though the model might be useful in some cases it's probably not always the right choice
06:24 I mean: what if the next version of choo starts using state mutation using uehhh, observables or something
06:24 you'd be stuck. not saying we'll do that, but who knows what you'll be running 2 years from now

[timwis] so you're saying it may make sense for the component to do its own reducing and just pass the fully patched state up to the callback?

[yoshuawuyts] yeah pretty much

[timwis] well, either fully patched state or at least easy-to-use updates that you can just apply to state using xtend/object.assign

[yoshuawuyts] yup yup yup

Activity

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

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions