Multiple React components in a single module

后端 未结 4 1942
悲&欢浪女
悲&欢浪女 2020-12-08 21:43

I am new to the whole browserify thing. I have been trying to use browserify + reactify + gulp to transform, minify and combine a React application. As long as I have a sing

4条回答
  •  温柔的废话
    2020-12-08 22:01

    I use function to return component.

     module.exports = {
       comp1: function(){
         return Component1;
       }
     }
    

    Then

    var myCompontents = require('./components');
    var comp1 = myComponents.comp1();
    

提交回复
热议问题