Day-1 React JS Overview

Let’s see: https://en.wikipedia.org/wiki/Programming_languages_used_in_most_popular_websites

React is a front-end library developed by Facebook. It is used for handling the view layer for web and mobile apps. React JS allows us to create reusable UI components. It is currently one of the most popular JavaScript libraries and has a strong foundation and large community behind it.

React Features

In Depth Overview of Flux: http://facebook.github.io/flux/docs/in-depth-overview.html#content

React Advantages:



React Limitations:


Source: https://www.tutorialspoint.com/reactjs/reactjs_overview.html

MVC Structure:


Flux Structure:


Babel is a JavaScript compiler. Use next generation JavaScript, today.


Example # 1: Iterate an array in JavaScript

var myStringArray = ["UiO","DHIS2","UNICEF", "HISP BD", "WHO","ICDDRB","SCI"];
for (var i = 0; i < myStringArray.length; i++) {
    console.log(myStringArray[i]);
    //Do something
}

Example # 2: 
 
let arr=["UiO","DHIS2","UNICEF", "HISP BD", "WHO","ICDDRB","SCI"];
arr.map((info)=>{
  console.log("Array Iteration: ",info);
});

Example # 3:

const numbers = [1, 2, 3, 4, 5];
const doubled = numbers.map((number) => number * 2);
console.log(doubled);

Next generation JS: [1,2,3].map(n => n + 1);

Get browser compatible JS: 

[1, 2, 3].map(function (n) {
  return n + 1;
});

More Details:  https://babeljs.io/ 

Babel has support for the latest version of JavaScript through syntax transformers. These plugins allow you to use new syntax, right now without waiting for browser support. Check out our env preset to get started.

You can install this preset with:
npm install --save-dev babel-preset-env
and add “env” to your .babelrc presets array. ES6 is the next JavaScript version and supported by all browsers, do not need to convert ES6 to ES5 codes,

More detail: https://babeljs.io/learn-es2015/


Note: ECMAScript is a trademarked scripting-language specification standardized by Ecma International in ECMA-262 and ISO/IEC 16262. It was created to standardize JavaScript, so as to foster multiple independent implementations

Since Babel only transforms syntax (like arrow functions), you can use babel-polyfill in order to support new globals such as Promise or new native methods like String.padStart (left-pad). It uses core-js and regenerator. Check out our babel-polyfill docs for more info.

You can install the polyfill with:

npm install --save-dev babel-polyfill

Use it by requiring it at the top of the entry point to your application or in your bundler config.


Babel can convert JSX syntax and strip out type annotations. Check out our React preset to get started. Use it together with the babel-sublime package to bring syntax highlighting to a whole new level.

You can install this preset with:

npm install --save-dev babel-preset-react
and add "react" to your .babelrc presets array.
The JSX code:


  Click Me


Compiles into:

React.createElement(
  MyButton,
  {color: 'blue', shadowSize: 2},
  'Click Me'
)

More Detail: https://reactjs.org/docs/jsx-in-depth.html

Webpack is an open-source JavaScript module bundler. Webpack takes modules with dependencies and generates static assets representing those modules.

babel-loader is the Webpack loader responsible for taking in the ES6 code and making it understandable by the browser of choice

The main purpose is to bundle JavaScript files for usage in a browser, yet it is also capable of transforming, bundling, or packaging just about any deployment target running javascript (node, electron, atom, web, web worker).

Webpack bundles both ES6, CommonJS, and AMD modules (even combined). In addition to code-splitting, webpack can create a single bundle or multiple chunks that are asynchronously loaded at runtime (to reduce initial loading time). Dependencies are resolved during compilation reducing the runtime size.

Loaders can preprocess files while compiling, e.g. coffeescript to JavaScript, handlebars strings to compiled functions, images to Base64, etc. webpack makes no assumption about your workflow, framework of choice, or development environment, and because of that, we are in the top 1% most used packages on npm!!!

Webpack has a highly modular and configurable plugin system that lets you do whatever else your application requires.

Source: https://opencollective.com/webpack#about




Let’s see: https://en.wikipedia.org/wiki/Programming_languages_used_in_most_popular_websites

React is a front-end library developed by Facebook. It is used for handling the view layer for web and mobile apps. React JS allows us to create reusable UI components. It is currently one of the most popular JavaScript libraries and has a strong foundation and large community behind it.

React Features

In Depth Overview of Flux: http://facebook.github.io/flux/docs/in-depth-overview.html#content

React Advantages:



React Limitations:


Source: https://www.tutorialspoint.com/reactjs/reactjs_overview.html

MVC Structure:


Flux Structure:


Babel is a JavaScript compiler. Use next generation JavaScript, today.


Example # 1: Iterate an array in JavaScript

var myStringArray = ["UiO","DHIS2","UNICEF", "HISP BD", "WHO","ICDDRB","SCI"];
for (var i = 0; i < myStringArray.length; i++) {
    console.log(myStringArray[i]);
    //Do something
}

Example # 2: 
 
let arr=["UiO","DHIS2","UNICEF", "HISP BD", "WHO","ICDDRB","SCI"];
arr.map((info)=>{
  console.log("Array Iteration: ",info);
});

Example # 3:

const numbers = [1, 2, 3, 4, 5];
const doubled = numbers.map((number) => number * 2);
console.log(doubled);

Next generation JS: [1,2,3].map(n => n + 1);

Get browser compatible JS: 

[1, 2, 3].map(function (n) {
  return n + 1;
});

More Details:  https://babeljs.io/ 

Babel has support for the latest version of JavaScript through syntax transformers. These plugins allow you to use new syntax, right now without waiting for browser support. Check out our env preset to get started.

You can install this preset with:
npm install --save-dev babel-preset-env
and add “env” to your .babelrc presets array. ES6 is the next JavaScript version and supported by all browsers, do not need to convert ES6 to ES5 codes,

More detail: https://babeljs.io/learn-es2015/


Note: ECMAScript is a trademarked scripting-language specification standardized by Ecma International in ECMA-262 and ISO/IEC 16262. It was created to standardize JavaScript, so as to foster multiple independent implementations

Since Babel only transforms syntax (like arrow functions), you can use babel-polyfill in order to support new globals such as Promise or new native methods like String.padStart (left-pad). It uses core-js and regenerator. Check out our babel-polyfill docs for more info.

You can install the polyfill with:

npm install --save-dev babel-polyfill

Use it by requiring it at the top of the entry point to your application or in your bundler config.


Babel can convert JSX syntax and strip out type annotations. Check out our React preset to get started. Use it together with the babel-sublime package to bring syntax highlighting to a whole new level.

You can install this preset with:

npm install --save-dev babel-preset-react
and add "react" to your .babelrc presets array.
The JSX code:


  Click Me


Compiles into:

React.createElement(
  MyButton,
  {color: 'blue', shadowSize: 2},
  'Click Me'
)

More Detail: https://reactjs.org/docs/jsx-in-depth.html

Webpack is an open-source JavaScript module bundler. Webpack takes modules with dependencies and generates static assets representing those modules.

babel-loader is the Webpack loader responsible for taking in the ES6 code and making it understandable by the browser of choice

The main purpose is to bundle JavaScript files for usage in a browser, yet it is also capable of transforming, bundling, or packaging just about any deployment target running javascript (node, electron, atom, web, web worker).

Webpack bundles both ES6, CommonJS, and AMD modules (even combined). In addition to code-splitting, webpack can create a single bundle or multiple chunks that are asynchronously loaded at runtime (to reduce initial loading time). Dependencies are resolved during compilation reducing the runtime size.

Loaders can preprocess files while compiling, e.g. coffeescript to JavaScript, handlebars strings to compiled functions, images to Base64, etc. webpack makes no assumption about your workflow, framework of choice, or development environment, and because of that, we are in the top 1% most used packages on npm!!!

Webpack has a highly modular and configurable plugin system that lets you do whatever else your application requires.

Source: https://opencollective.com/webpack#about