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

Rendering more than one. #9

Open
BozhidarRusev opened this issue Jan 25, 2023 · 0 comments
Open

Rendering more than one. #9

BozhidarRusev opened this issue Jan 25, 2023 · 0 comments

Comments

@BozhidarRusev
Copy link

BozhidarRusev commented Jan 25, 2023

Hello, thank you for this library. I am switching from react-fill-slots library to yours, because of keeps updating with the new ReactJs version. I am trying to solve one problem. Let me give you an example.

This is my component where I am using Fill with name Sidebar.Content

`export default function Sidebar({ label, order, children, renderDontFill = false }) {
  const content = (
    <Section order={order}>
      <Header>{label}</Header>
      {children}
    </Section>
  );
  return renderDontFill ? content : <Fill name="Sidebar.Content">{content}</Fill>;
}`

This is my component where I am using <Slot name="Sidebar.Content>


function Sidebar() {
          <SlotsProvider>
              <Slot name="Sidebar.Content">
                {(elements) => (
                  <div>
                    {elements.sort((l, r) => (l.props.order || 1000) - (r.props.order || 1000))}
                  </div>
                )}
          </SlotsProvider>    
  );
}

if content In Sidebar is more than one it always displays the last one. In previous library react-slot-fill there is functionality of getting byName which returns Fill[] . Is there a way to solve this with your library ?

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

No branches or pull requests

1 participant