| Okay I see where you're coming from. > if that change also didn't enforce that way of thinking My gut says that your mental model would lead to overall more spaghetti than the current one. I also think that remounting all the DOM nodes is the correct default, since it clears any uncontrolled input and open popovers. Any shared settings between routes/forms etc. are custom behavior for user-convenience and should require additional code. > needs to be applied by the consumer of the component, not the component itself Depends on how you look at it. In my mental model, the client is actually requesting multiple form components, each with a different default value. Like 50 list cells where only one is visible. It's not a coincidence that lists and state-resets are implemented with the same api. But if you want to colocate this behavior, there's still the option to build a small wrapper: function FormWrapper({ item }) { return <FormInner key={item.id} … />
}
|