How to create helper file full of functions in react native?

后端 未结 6 742
悲哀的现实
悲哀的现实 2020-12-04 06:48

Though there is a similar question I am failing to create a file with multiple functions. Not sure if the method is already outdated or not as RN is evolving very fast. How

6条回答
  •  [愿得一人]
    2020-12-04 07:23

    If you want to use class, you can do this.

    Helper.js

      function x(){}
    
      function y(){}
    
      export default class Helper{
    
        static x(){ x(); }
    
        static y(){ y(); }
    
      }
    

    App.js

    import Helper from 'helper.js';
    
    /****/
    
    Helper.x
    

提交回复
热议问题