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

Static subcomponents only work with specific export syntax #324

Open
AndrewLeedham opened this issue Feb 18, 2021 · 8 comments
Open

Static subcomponents only work with specific export syntax #324

AndrewLeedham opened this issue Feb 18, 2021 · 8 comments

Comments

@AndrewLeedham
Copy link
Contributor

#265 added a nice feature to expose static subcomponents, which is great! However, it seems to be very fussy about how things are exported.

For example the following works:

const SubComponent = (): ReactElement => {
  return <p>sub component</p>
}

export const Component = (): ReactElement => {
  return <p>component</p>
}

Component.SubComponent = SubComponent;

However the following scenarios do not:

const SubComponent = (): ReactElement => {
  return <p>sub component</p>
}
const Component = (): ReactElement => {
  return <p>component</p>
}

Component.SubComponent = SubComponent;

export { Component };
const SubComponent = (): ReactElement => {
  return <p>sub component</p>
}

function Component(): ReactElement {
  return <p>component</p>
}

Component.SubComponent = SubComponent;

export { Component };
const SubComponent = (): ReactElement => {
  return <p>sub component</p>
}

export default function Component(): ReactElement {
  return <p>component</p>
}

Component.SubComponent = SubComponent;
const SubComponent = (): ReactElement => {
  return <p>sub component</p>
}
const Component = (): ReactElement => {
  return <p>component</p>
}

Component.SubComponent = SubComponent;

export default Component;

cc @hipstersmoothie

@hipstersmoothie
Copy link
Contributor

I might not have time to address this any time soon. Will help a PR along though! The code is pretty approachable and @pvasek wrote a great test suite.

@github-actions
Copy link

github-actions bot commented Oct 9, 2021

There was no activity for a long time. Closing this issue as obsolete. In case it is still valid, please, open a new one.

@github-actions github-actions bot added the stale There is no activity for a long time. label Oct 9, 2021
@pvasek pvasek removed the stale There is no activity for a long time. label Oct 9, 2021
@AndyOGo
Copy link

AndyOGo commented Jan 20, 2022

+1

@github-actions
Copy link

There was no activity for a long time. The issue will be closed soon.

@github-actions github-actions bot added the stale There is no activity for a long time. label Jan 21, 2023
@AndyOGo
Copy link

AndyOGo commented Jan 22, 2023

+1

@github-actions github-actions bot removed the stale There is no activity for a long time. label Jan 23, 2023
Copy link

There was no activity for a long time. The issue will be closed soon.

@github-actions github-actions bot added the stale There is no activity for a long time. label Jan 24, 2024
@AndyOGo
Copy link

AndyOGo commented Jan 24, 2024

+1

@github-actions github-actions bot removed the stale There is no activity for a long time. label Jan 25, 2024
@hipstersmoothie
Copy link
Contributor

@AndyOGo you should give it a shot :D

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging a pull request may close this issue.

4 participants