Home > mui-country-code-selector > CCSelectorState > initialize
This API is provided as an alpha preview for developers and may change based on feedback that we receive. Do not use this API in a production environment.
Initializes the component and returns a cleanup function. This, or the individual setter and cleanup functions, must be called in a useEffect
hook in the component body. Provides an easy way to take care of the initialization and the cleanup.
Parameters:
errorMsgDelay
- Time the error message is displayed in seconds.
errorHandler
- An external error handler function to which the error message is forwarded to.
changeHandler
- An external change handler function to which the current phone number value is forwared every time the value changes.
Signature:
initialize: (errorMsgDelay?: number, errorHandler?: ((error: string) => void) | undefined, changeHandler?: ((event: {
target: {
value: string;
};
}) => void) | undefined) => () => void;