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

Rename className param used in the callback function within composeRenderProps #80

Open
NikitaRevenco opened this issue Oct 26, 2024 · 1 comment

Comments

@NikitaRevenco
Copy link

NikitaRevenco commented Oct 26, 2024

Everywhere in the library we are shadowing the className variable in the callback function (2nd argument to composeRenderProps):

      className={composeRenderProps(className, (className) =>
        cn("group flex flex-col gap-2", className),
      )}

It's problematic because a lot of projects use ESLint no-shadow rule. Which generates many errors for each of these files

Same with this:

      {composeRenderProps(children, (children) => (
        <>
          {children}
          <ChevronDown aria-hidden="true" className="size-4 opacity-50" />
        </>
      ))}

children is being shadowed, changing it to something like renderChildren won't trigger ESLint errors

examples are taken from Select component

@musjj
Copy link

musjj commented Oct 30, 2024

The composeRenderProps isn't actually necessary at all in most cases and you can just do className={cn(...)}.

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

2 participants