Link Search Menu Expand Document

getMessage() function

Given a MessageContext instance, fetches an entry from the messages object of the current or given locale. The returned value will be undefined if not found, or otherwise exactly as set in the MessageProvider props.

Signature:

export declare function getMessage(context: MessageContext, id?: string | string[], locale?: string | string[]): any;

Parameters

Parameter Type Description
context MessageContext  
id string | string[] The key or key path of the message or message object. If empty or [], matches the root of the messages object
locale string | string[] If set, overrides the current locale precedence as set by parent MessageProviders.

Returns:

any