react#createContext TypeScript Examples

The following examples show how to use react#createContext. You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example #1
Source File: store-context.tsx    From video-chat with MIT License 7 votes vote down vote up
storeContext = createContext({} as RootStoreType)
Example #2
Source File: groupWatch.tsx    From frames with Mozilla Public License 2.0 6 votes vote down vote up
GroupWatchContext = createContext<GroupWatchContextInterface>({
    connected: false,
    data: undefined,
    sendData: () => {
    },
    disconnect: () => {
    },
    connect: () => {
    },
})
Example #3
Source File: BuySellContext.ts    From index-ui with MIT License 6 votes vote down vote up
BuySellContext = createContext<BuySellContextValues>({
  buySellToken: 'dpi',
  isFetchingOrderData: false,
  isUserBuying: true,
  activeField: 'currency',
  selectedCurrency: undefined,
  spendingTokenBalance: new BigNumber(0),
  zeroExTradeData: undefined,
  currencyOptions: [],
  buySellQuantity: '0',
  onSetBuySellToken: () => {},
  onToggleIsUserBuying: () => {},
  onSetActiveField: () => {},
  onSetSelectedCurrency: () => {},
  onSetBuySellQuantity: () => {},
  onExecuteBuySell: () => {},
})
Example #4
Source File: context.tsx    From hypertext with GNU General Public License v3.0 6 votes vote down vote up
HypertextContext = createContext<
  [
    {
      firstToken: Token | undefined
      secondToken: Token | undefined
      showUSD: boolean
      approveMax: boolean
      deadline: number
      slippage: number
      transactions: Transaction[]
      tokens: Token[]
    },
    {
      setFirstToken: Dispatch<SetStateAction<Token | undefined>>
      setSecondToken: Dispatch<SetStateAction<Token | undefined>>
      setShowUSD: Dispatch<SetStateAction<boolean>>
      setApproveMax: Dispatch<SetStateAction<boolean>>
      setDeadline: Dispatch<SetStateAction<number>>
      setSlippage: Dispatch<SetStateAction<number>>
      setTransactions: Dispatch<SetStateAction<Transaction[]>>
      setTokens: Dispatch<SetStateAction<Token[]>>
    }
  ]
>([{}, {}] as any)
Example #5
Source File: InterestRatesView.tsx    From rari-dApp with GNU Affero General Public License v3.0 6 votes vote down vote up
InterestRatesContext = createContext<InterestRatesContextType>({
  selectedTable: InterestRatesTableOptions.Lending,
  tokens: [],
  fusePools: [],
  markets: {
    aave: [],
    compound: [],
    fuse: {},
  },
  marketDataLoaded: false,
})
Example #6
Source File: index.tsx    From chartsy with GNU General Public License v3.0 6 votes vote down vote up
TitlesContext = createContext<{
  titles: Title[];
  setTitles: Dispatch<SetStateAction<Title[]>>;
  lastUsed: number;
  setLastUsed: Dispatch<SetStateAction<number>>;
}>({
  titles: [...TitlesDefault],
  setTitles: () => null,
  lastUsed: 0,
  setLastUsed: () => null,
})
Example #7
Source File: context.ts    From useDApp with MIT License 6 votes vote down vote up
NetworkContext = createContext<{
  update: (network: Partial<Network>) => void
  reportError: (error: Error) => void
  activate: (provider: JsonRpcProvider | ExternalProvider) => Promise<void>
  deactivate: () => void
  network: Network
  activateBrowserWallet: () => void
  isLoading: boolean
}>({
  network: {
    provider: undefined,
    chainId: ChainId.Mainnet,
    accounts: [],
    errors: [],
  },
  update: () => undefined,
  reportError: () => undefined,
  activate: async () => undefined,
  deactivate: () => undefined,
  activateBrowserWallet: () => undefined,
  isLoading: true,
})
Example #8
Source File: NavigationTabsContext.ts    From amplication with Apache License 2.0 6 votes vote down vote up
NavigationTabsContext = createContext<ContextDataType>({
  items: [],
  registerItem: (item: NavigationTabItem) => {
    throw new Error();
  },
  unregisterItem: (url: string) => {
    throw new Error();
  },
})
Example #9
Source File: BreadcrumbContext.tsx    From one-platform with MIT License 5 votes vote down vote up
BreadcrumbContext = createContext<BreadcrumbContextProps | Record<string, unknown>>({})
Example #10
Source File: Dialog.tsx    From Demae with MIT License 5 votes vote down vote up
DialogContext = createContext<[(title: string | undefined, body: string | undefined, actions: Action[]) => void, () => void, boolean]>([() => { }, () => { }, false])
Example #11
Source File: LocalUserContext.tsx    From ReactNative-UIKit with MIT License 5 votes vote down vote up
LocalContext = createContext<UidInterface>({} as UidInterface)
Example #12
Source File: MediaQueryProvider.tsx    From akashlytics with GNU General Public License v3.0 5 votes vote down vote up
MediaQueryContext = createContext(null)
Example #13
Source File: index.tsx    From react-doc-viewer with Apache License 2.0 5 votes vote down vote up
PDFContext = createContext<{
  state: IPDFState;
  dispatch: Dispatch<PDFActions>;
}>({ state: initialPDFState, dispatch: () => null })
Example #14
Source File: context.tsx    From anchor-web-app with Apache License 2.0 5 votes vote down vote up
AnchorWebappContext: Context<AnchorWebapp> =
  // @ts-ignore
  createContext<AnchorWebapp>()
Example #15
Source File: useSession.tsx    From firebase-react-typescript-project-template with MIT License 5 votes vote down vote up
SessionContext = createContext<Session>({ loading: true })
Example #16
Source File: AcceptedGroupIdProvider.tsx    From caritas-onlineBeratung-frontend with GNU Affero General Public License v3.0 5 votes vote down vote up
AcceptedGroupIdContext = createContext<any>(null)
Example #17
Source File: metamask.tsx    From metamask-snap-polkadot with Apache License 2.0 5 votes vote down vote up
MetaMaskContext = createContext<[MetamaskState, Dispatch<MetamaskDispatch>]>([initialState, () => {}])
Example #18
Source File: GridContext.tsx    From Pi-Tool with GNU General Public License v3.0 5 votes vote down vote up
GridContext = createContext<{ items: number[] }>({ items: [] })
Example #19
Source File: ExposureNotificationServiceProvider.tsx    From mobile with Apache License 2.0 5 votes vote down vote up
ExposureNotificationServiceContext = createContext<ExposureNotificationService | undefined>(undefined)
Example #20
Source File: guildAvailability.tsx    From dxvote with GNU Affero General Public License v3.0 5 votes vote down vote up
GuildAvailabilityContext =
  createContext<GuildAvailabilityContextInterface>({})
Example #21
Source File: castContext.tsx    From frames with Mozilla Public License 2.0 5 votes vote down vote up
CastContext = createContext<Cast | undefined>(undefined)
Example #22
Source File: auth.tsx    From gobarber-mobile with MIT License 5 votes vote down vote up
AuthContext = createContext<AuthContextData>({} as AuthContextData)
Example #23
Source File: auth.tsx    From gobarber-web with MIT License 5 votes vote down vote up
AuthContext = createContext<AuthContextData>({} as AuthContextData)
Example #24
Source File: cart.tsx    From rocketseat-gostack-11-desafios with MIT License 5 votes vote down vote up
CartContext = createContext<CartContext | null>(null)
Example #25
Source File: context.ts    From generator-earth with MIT License 5 votes vote down vote up
BaseContext = createContext({
    CONTAINER_ROUTE_PREFIX: '',
})
Example #26
Source File: Context.tsx    From vitty-extension with GNU General Public License v3.0 5 votes vote down vote up
AppContext = createContext<ContextType>({} as any)
Example #27
Source File: FormWizardContext.tsx    From jmix-frontend with Apache License 2.0 5 votes vote down vote up
FormWizardContext = createContext<{
    formWizardStore: FormWizardStore,
    formWizardHelpersRef: React.MutableRefObject<FormWizardHelpers>,
}>({
    formWizardStore: new FormWizardStore(),
    formWizardHelpersRef: defaultFormWizardHelpers,
})
Example #28
Source File: Context.ts    From index-ui with MIT License 5 votes vote down vote up
Context = createContext<ContextValues>({})