rfcs icon indicating copy to clipboard operation
rfcs copied to clipboard

RFC: Connect Container Component

Open tkow opened this issue 3 years ago • 1 comments

This rfc is child hooks extended can be passed from a special prop by named inner Hooks.

My proposal is simulated by hoc in Code Sand Box. Actually, as I thought createElement layer is appropriate.

And I found two patterns this may be also realized opt-in style from component property like

// In this pattern one of advantages is easy to type innerHooks returns Props.
// It is Omit<OriginalProp, HocProps>.

const Component = (props) => anyComponent

export const Component.useInnerHooks<OriginalProp, HocProps>() // this line generate intermediate component.

and Component belongs pattern.

// In thhis pattern one of advantages is to keep original component definition.

const Component = (props) => anyComponent

// another file
import Component from  './Component'

function App () {
 return (
   <Component.InnerHooks>
 )
}

view RFC

I change this proposal name from InnerHooks to Connect Container Component more precisely description I want to do prior and my demo library api name followed it.

tkow avatar Feb 06 '22 13:02 tkow

I also made library realized this concept. See if you interested in it see this link.

tkow avatar Feb 11 '22 07:02 tkow