Last active
June 2, 2024 15:13
-
-
Save mficzel/5c9c8e54f5a327123f07d762b34e2053 to your computer and use it in GitHub Desktop.
Wrapper components
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
prototype(Vendor.Site:Example) < prototype(Neos.Fusion:Component) { | |
foo = null | |
bar = null | |
renderer = Neos.Fusion:Component { | |
# pass all outer props to the renderer | |
@apply.props = ${props} | |
# alternatively pass explicit props to the renderer | |
foo = ${props.foo} | |
# calculate additional props based on outer props | |
barTransformed = Neos.Fusion:Map { | |
items = ${props.bar} | |
itemRenderer = ... | |
} | |
renderer = afx`...` | |
} | |
} |
That is not exactly equivalent as @context is available in the whole chain below while props are evaluated fresh for each component.
In usual cases it may look equivalent but has some important deviations.
OK, good call. I like the brevity of it, but it's not the same you're right
FYI: in the meantime private props can be used to achieve the same without the drawbacks mentioned above
Totally agree @private
is nowadays the way to go
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Just for the record, an alternative syntax using
@context
: