You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: src/lib/utils/fieldComponents.js
+15Lines changed: 15 additions & 0 deletions
Original file line number
Diff line number
Diff line change
@@ -1,6 +1,21 @@
1
1
import{useFormikContext}from"formik";
2
2
import*asReactfrom"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
+
* This function is adapted from `react-overridable`: https://github.com/indico/react-overridable/blob/d1ecfbec9993a461717824259900eec82d59f1e0/src/overridable.js#L7-L33
15
+
*
16
+
* @param Component - the React component to override the parameters, as in `parametrize` from react-overridable.
17
+
* @param {function} propsFactory - function returning the props to override the component with
0 commit comments