Skip to main content

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

  1. 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 sent
  • apiKey - unique readonly key for requests
  • userId - id of the user whose data is to be obtained
  • updateInterval - the frequency of calling requests in ms. If 0, then the request will be executed only once. Default 0
  • language - language for translations. Default en
  1. 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>