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

Passing a class to the adhoc container element #37

Open
seahindeniz opened this issue Jun 27, 2023 · 4 comments
Open

Passing a class to the adhoc container element #37

seahindeniz opened this issue Jun 27, 2023 · 4 comments

Comments

@seahindeniz
Copy link

Hello, is it possible that we could just pass a static, non-transition related class to the container element which gets to contain the children passed to Transition component and rendered as a parent element?

@thetarnav
Copy link
Member

hmm I'm not sure I understand the issue
From what I see the <Transition> component doesn't render any elements on it's own — it only passes through the elements passed as children.
Unless you mean that there should be a base class prop that always gets applied to the child, regardless of the transition state.

@seahindeniz
Copy link
Author

Yes, that's what I was referring

@thetarnav
Copy link
Member

Ok, that sounds like a reasonable feature request.
It would be probably very easy to add too. Just appending the default class to the ones added on enter.
So if that works well I'm down to add that.

@thetarnav
Copy link
Member

thetarnav commented Aug 4, 2023

Hey, I was going to add this now, and I realized that it's not that simple.
The classes are applied as a transition mechanism. They are not being applied the same way props on a html element in jsx are, nor they are being "passed down" to the child element. So static classes don't really fit the model here.
I was going to ignore that, and add it anyway just for the class since it kind of makes sense considering there are other class props, so why not a static one?
But there are two issues with applying a static class using the mechanism of transitions:

  1. The transition doesn't run on the server — the transition classes are not applied during SSR — the initial page will be lacking those "static" classes.

  2. When appear prop is disabled, the enter transition (where I'm applying classes) is not executed, so the initial elements won't have the "static" classes.

Unless the architecture of transition group changes, (which is not out of the question I think) applying static classes doesn't make sense. It will just cause more problems then solve.

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