Import and require difference in react

Require:
This allows us to have dynamically load module which isnt predefined or we can also conditionally load  a module when we reuire it.
Ex: var Navitem =require (“./components/NavItem”);
Imports:
We can use ES6 import to selectively load the pieces which we need and by doing this we can save memory.
import Navitem from(“./components/NavItem);

require is in ES 5 and in ES 6 we make use of import

React js

React is a javascript library which can be used to develop user interfaces. We can also use it to develop complex and amazing web apps. It can be also be combined with Redux and many other tools to develop amazing applications.

NPM (Node.js package manager)

NPM comes with node.js installation. It is node.js package manager, as the name suggests it is used to install node programs/modules. We can also easily specify and link dependencies.

npm install express                                installs express module

npm install express –save                     installs express and updates the dependencies in package.json

Modules get installed into the “node_modules” folder .