Skip to content

Commit 510174d

Browse files
committed
doc: add jsdoc comment for `dynamicParametrize
1 parent 214e88d commit 510174d

File tree

1 file changed

+13
-0
lines changed

1 file changed

+13
-0
lines changed

src/lib/utils/fieldComponents.js

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,19 @@
11
import { useFormikContext } from "formik";
22
import * as React from "react";
33

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+
*/
417
export function dynamicParametrize(Component, propsFactory) {
518
const ParametrizedComponent = (props) => {
619
const { values } = useFormikContext();

0 commit comments

Comments
 (0)