Open johnrom opened 4 years ago
Hey @johnrom are you working on this? or have some plans?
I think we might also need to change the prop name or introduce a new prop for this. As enable
keyword is a boolean keyword - either true or false.
I like the name that React has shouldComponentUpdate
I don't have any plans to work on this one, it just came from a bunch of issues and I wanted to formalize a potential solution.
I think shouldX
only really applies for boolean hooks, whereas this one should be more reducer-like, like:
// on reinitialize, set all fields to touched
const onReinitialize = (state: Readonly<FormikState<Values>>, props: FormikProps<Values>) => ({
...state,
touched: setNestedObjectValues(
props.initialValues,
true
);
});
🚀 Feature request
Current Behavior
enableReinitialize={true} only reinitializes in certain circumstances, only reinitializes certain things, and is not extensible.
Desired Behavior
Instead, I think we should allow a user to trigger any kind of re-renders they need.
Suggested Solution
Who does this impact? Who is this for?
People with advanced reinitialization needs.
Describe alternatives you've considered
Telling people to create custom effects.
Additional Context
181