javascript - Common js modules in react native -


is possible make use of common js modules react-native? use case sharing logic between mobile , web version of react project.

ok, i'm new think i've figured out how include js code. didn't have add standard react native installation.

create library of code:

//library.js exports.foo = function() {    //do stuff here   return "here";  } 

import js file:

var lib = require("./library.js"); var mystring = lib.foo(); 

i found info blog post:

http://0fps.net/2013/01/22/commonjs-why-and-how/


Comments

Popular posts from this blog

cakephp - simple blog with croogo -

How to group boxplot outliers in gnuplot -

bash - Performing variable substitution in a string -