Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

RFC: Connect Container Component #210

Open
wants to merge 2 commits into
base: main
Choose a base branch
from
Open

RFC: Connect Container Component #210

wants to merge 2 commits into from

Conversation

tkow
Copy link

@tkow tkow commented Feb 6, 2022

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
Copy link
Author

tkow commented Feb 11, 2022

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

@tkow tkow changed the title RFC: Inner Hooks RFC: Connect Container Component May 29, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

2 participants