react-through
  • README
  • Introduction
    • Motivation
    • Core Concepts
  • Basics
    • Installation and setup
    • Direct Mapping
    • Many Agents
  • Glossary
  • API Reference
    • ThroughProvider
    • createAgent
    • createAdvAgent
    • Through
    • throughDirect
    • throughArea
    • throughContainer
    • Internals
      • Internal Agent Interface
Powered by GitBook
On this page
  1. API Reference

throughContainer

High Order Component merge the whole area to the wrapped component props as single item named with name of area.

Advanced container is usable for cases where more than one area is required or container itself is rendered with additional props which may overlap props from agent.

Whole through area is mapped to prop with name of correspondent through area. Higher-order components creator function throughContainer is used for that like this:

import {throughContainer} from 'react-through'

const areaName = 'myAreaName'
const bearingPropName = 'id'

const MyContainer = (props) => {
  const agentProps = props[areaName][bearingPropName]

  return (
    <div>
      {agentProps.value}
    </div>
  )
}


export default throughContainer(areaName)(MyContainer)
PreviousthroughAreaNextInternals

Last updated 5 years ago