Is it bad practice/design to nest components inside components using Flex 4? Should I simply be creating components and inserting them into my main application as below, or doesn't it matter?
<com:MyComp1>
<com:MyComp2>
<com:MyComp3>
<s:Label text="This is a test."/>
</com:MyComp3>
</com开发者_JAVA百科:MyComp2>
</com:MyComp1>
If MyComp1
, MyComp2
and MyComp3
are a containers then it's the recommended workflow. Custom containers in Flex 4 usually extend SkinnableContainerBase
or Group
. If the given code is used more than once then it's recommended to refactor it into a custom big component.
If they are not designed to contain unknown visual elements then it's a bad practice. Defining components inline is also known as bad practice in production code.
精彩评论