parentSpaced
A higher-order React component that wraps a component in a ParentSpaceProvider
.
Arguments
options
(Object): An optional object to supply the following options:context
(React.Context|Object): Override the React Context used for accessing the store. An object can be passed with separateparent
andchild
contexts if required.
Returns
(Function): A function that takes a React Component and returns it wrapped in a ParentSpaceProvider
.
Examples
import { parentSpaced } from "react-redux-subspace"
import AComponent from "somewhere"
const MyComponent = parentSpaced()(AComponent)
import React from "react"
import { parentSpaced } from "react-redux-subspace"
import AComponent from "somewhere"
const CustomReduxContext = React.createContext()
const MyComponent = parentSpaced({
context: CustomReduxContext
})(AComponent)
import React from 'react'
import { parentSpaced } from "react-redux-subspace"
import AComponent from "somewhere"
const CustomParentContext = React.createContext()
const CustomChildContext = React.createContext()
const MyComponent = parentSpaced({
context: { parent: CustomParentContext, child: CustomChildContext }
})(AComponent)