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

Component static method pattern missing. #21

Open
reinisriekstins opened this issue Dec 29, 2016 · 1 comment
Open

Component static method pattern missing. #21

reinisriekstins opened this issue Dec 29, 2016 · 1 comment

Comments

@reinisriekstins
Copy link

reinisriekstins commented Dec 29, 2016

Hello.

I believe that reactpatterns.com is missing a design pattern I recently stumbled across here: http://webrafter.com/opensource/react-foundation-apps/tabs
It adds static methods to a React component factory/class, that are also React factories or classes, making the JSX code look like this (notice the dot in Tabs.Tab):
<Tabs> <Tabs.Tab title='Tab 1'> Tab 1 content </Tabs.Tab> <Tabs.Tab title='Tab 2'> Tab 2 content </Tabs.Tab> <Tabs.Tab title='Tab 3'> Tab 3 content </Tabs.Tab> </Tabs>

While not strictly a React design pattern, since this can be done with any function, I hadn't thought that you could do something like that with a React component and think that it belongs on your excellent website.

@chantastic
Copy link
Owner

Thanks for the issue!

I think that this falls more into code organization than component patterns. I've considered making a separate page for code organization. The tricky thing about code organization is that depends on what tooling you are using to build apps. This technique could be done using window, module.exports, or export. It looks like akiran is using module.exports in his code.

Let me know if I misread that but if it's code organization, this probably won't be the best place.

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