UNPKG

@adyen/kyc-components

Version:

This guide assumes that you have already an account with Adyen. A legalEntity needs to be created, and you need to have a `legalEntityId` to instatiate a Component.

17 lines (16 loc) 885 B
/** * This is a 'hacky' way to handle components which may have props either controlled or uncontrolled. * * Avoid using it if at all possible - generally it's better to write a controlled inner component * and simply make an uncontrolled version which wraps it. * * * If controlled, we mirror the prop state and propagate changes upwards via {@link propOnChange}. * * If uncontrolled, it is effectively a simple {@link useState()}. * * *Note: if mirroring, both `prop` and `propOnChange` **must** be provided.* * * @param prop the prop to be mirrored * @param propOnChange the handler to propagate changes from below back upwards * @param defaultVal the default value, only used if we aren't mirroring */ export declare function useMirrorProp<T>(prop: T | undefined, propOnChange: ((newVal: T) => void) | undefined, defaultVal: T | (() => T)): [T, (newVal: T) => void];