I have created one BaseComponent which will be extended in all other components :
import React, { Component } from \'react\'
import { ScrollView, Text, Image, Vi
In Nodejs each file is a treated as a module, that has its own scope of variables. When you import variable into file say React or ScrollView
for example, you add this variable to the module scope, but not to the global scope.
In case of webpack
you can use ProvidePlugin
to a few imports as global
new webpack.ProvidePlugin({
React: 'react' // ReactJS module name in node_modules folder
})
After that you are able to skip importing these variables variable in all of your modules as webpack
will do it itself handle it whereever needed.