I'm working in a React.js project which I need to import some JavaScript in others, and some others I have to export it.
For example I have A.js which needs some library:
var EventEmitter = require('EventEmitter');var React = require('react');//some code here//some function definitionvar fun = function(){...}module.exports = fun;And then I have another B.js which needs not only libraries but also my own JavaScript. For example B.js (I suppose both in the same folder):
var fun = require('./B.js');var React = require('react');//some other code hereI tried using the library requirejs and also try something with npm and nodejs but I'm not sure how it works.I'm using the flux-chat example