The map method creates a new array with the results of calling a provided function on every element in this array. Using map will call a provided callback function once for each element in an array, in order, and constructs a new array from the results.
The function that we pass as the first parameter of the reduce method receives two parameters, a and b. In this code, a is our accumulator. It will accumulate our sum as our function works. b is the current value being…
We are discuss here React Core Concept. It will be helpful for you.
React component is very important for us. React component has two type as class component and function component. When creating a React component, the component’s name must start with an upper case letter. …
Data types is an important concept. There have some data type as string, number, boolean, undefined, null, operator, objects, array etc. Strings are written with quotes. Booleans can only have two values true or false. Boolean are used in conditional statement.
An object is another important thing. Everything is an object. Object break big element and sort its small part by part. Objects contain have much value like function etc. …
Node.js is perfect for event-driven applications.
Every action on a computer is an event. Like when a connection is made or a file is opened.
Objects in Node.js can fire events, like the readStream object fires events when opening and closing a file.
Node.js has a built-in module, called “Events”, where you can create-, fire-, and listen for- your own events.
To include the built-in Events module use the
require() method. In addition, all event properties and methods are an instance of an EventEmitter object. To be able to access these properties and methods, create an EventEmitter object:
You can assign event handlers to your own events with the EventEmitter object.
In the example below we have created a function that will be executed when a “scream” event is fired.
To fire an event, use the
Each component in React has a lifecycle which you can monitor and manipulate during its three main phases.
The three phases are: Mounting, Updating, and Unmounting.
Mounting means putting elements into the DOM.
React has four built-in methods that gets called, in this order, when mounting a component:
render() method is required and will always be called, the others are optional and will be called if you define them.
constructor() method is called before anything else, when the component is initiated, and it is the natural place to set up the initial
state and other initial values.
constructor() method is called with the
props, as arguments, and you should always start by calling the
super(props) before anything else, this will initiate the parent's constructor method and allows the component to inherit methods from its parent (
ECMAScript 6 is also known as ES6 and ECMAScript 2015.
This chapter will introduce some of the new features in ES6.
**) (EcmaScript 2016)