createContext()

Turns a StateContainer into a consumable Context.

Definition

function createContext<
  TState,
  TContainer extends StateContainer<TState>
>(
  stateContainer: TContainer
): Context<WrappedStateContainer<TState, TContainer>>

See the StateContainer, WrappedStateContainer, and Context types.

Examples

Create Context from Zedux store:

import { createContext } from 'react-zedux'
import { createStore } from 'zedux'

const Context = createContext(createStore())

Create Context from observable:

import { createContext } from 'react-zedux'
import { Observable } from 'rxjs'

const Context = createContext(Observable.interval(1000))

Create Context from Redux store:

import { createContext } from 'react-zedux'
import { createStore } from 'redux'
import rootReducer from './rootReducer'

const Context = createContext(createStore(rootReducer))

results matching ""

    No results matching ""