rfcs
rfcs copied to clipboard
RFC: Connect Container Component
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>
)
}
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.
I also made library realized this concept. See if you interested in it see this link.