-
Notifications
You must be signed in to change notification settings - Fork 58
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
VisibleComponent - why do we need it? #759
Comments
Actually |
But couldn't you just solve this with the following? {
activeModules.includes('ImportButton') ? <ImportButton /> : null
} |
Yes, absolutely! But if you don't want to repeat it in your application several times, e.g. if it has to check it for n buttons in a group, you could use the HOC. |
Indeed it seems to look a little nicer, in the render method itself: const VisibleSimpleButton = isVisibleComponent(SimpleButton);
…
render(
<VisibleSimpleButton
activeModules={activeModules}
/>
) The ternery syntax is more clear to me and it feels more reactish. Maybe just a matter of taste. |
Reason why i brought attention to this: |
You're right about the |
Hrmm, can we make use of |
Closing this one, please refer to #650 for the usage of |
…/core-7.18.10 chore(deps-dev): bump @babel/core from 7.18.9 to 7.18.10
Why do we need a
VisibleComponent
?I think that detection if a component should be rendered or not is part of the render function in the specific parent. This would also lead to a performance gain.
Applications should handle that on their own - or use a util for this.
Besides, using a prop named
activeModules
is a very special thingy coming from a project and should not be included in this library.Thoughts @terrestris/devs ?
The text was updated successfully, but these errors were encountered: