Multiple React components in a single module. I have put multiple components in one file and export the object like you suggested.
1 2 3 4 | module.exports = { comp1: Component1, comp2: Component2 } |
Then where they are used do:
1 2 | var comp1 = require('your/path/to/components').comp1; var comp2 = require('your/path/to/components').comp2; |
If you like this question & answer and want to contribute, then write your question & answer and email to freewebmentor[@]gmail.com. Your question and answer will appear on FreeWebMentor.com and help other developers.