File tree Expand file tree Collapse file tree 1 file changed +13
-0
lines changed Expand file tree Collapse file tree 1 file changed +13
-0
lines changed Original file line number Diff line number Diff line change 1
1
import { useFormikContext } from "formik" ;
2
2
import * as React from "react" ;
3
3
4
+ /**
5
+ * Override the parameters of a component (similarly to `parametrize`) using certain available
6
+ * context variables.
7
+ *
8
+ * Currently, the following arguments are passed into the `propsFactory` function:
9
+ * - `formValues`: an object of the values in the Formik form state
10
+ *
11
+ * The `propsFactory` function should return an object of the props to be used for overriding the
12
+ * specified `Component`
13
+ *
14
+ * @param Component - the React component to override the parameters, as in `parametrize` from react-overridable.
15
+ * @param {function } propsFactory - function returning the props to override the component with
16
+ */
4
17
export function dynamicParametrize ( Component , propsFactory ) {
5
18
const ParametrizedComponent = ( props ) => {
6
19
const { values } = useFormikContext ( ) ;
You can’t perform that action at this time.
0 commit comments