GMFYProvider
import {GMFYProvider} from 'gmfy-sdk'
Motivation
This component is the context provider for all other components and hooks in the React SDK.
caution
Important! Without this component, other elements of the SDK will not have access to the context and will not be able to work.
Usage
- Create config like this
type Config = {
url: string,
apiKey: string,
userId: string,
updateInterval?: number,
language?: 'en' | 'ru'
}
url
- url of the server where requests will be sentapiKey
- unique readonly key for requestsuserId
- id of the user whose data is to be obtainedupdateInterval
- the frequency of calling requests in ms. If0
, then the request will be executed only once. Default0
language
- language for translations. Defaulten
- Use the component, along with the config
const config = {
url: "API_URL",
apiKey: "API_KEY",
userId: "1234",
updateInterval: 10000,
}
const App = () => <GMFYProvider config={config}>
{/* your application */}
</GMFYProvider>