Passing a class to the adhoc container element
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?
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.
Yes, that's what I was referring
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.
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:
-
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.
-
When
appearprop 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.