Sunday, 20 August 2017

What is ref in ReactJs ?

It is one of the attribute of React Element.
It provides simple access to the DOM Element represented by a React Element.
Attribute keyword is "ref" when use as an attribute but at the time of access element use as a "refs".

e.g.

class User extends Component {
    constructor(p){
        super(p)
    }

    onUserSelect(){
        console.log(this.refs.user.value);
    }

    render() {
        return (
<div>
              <label>Name</label>
              <input type="text" ref="user" />
             <button type="button" onClick={this.onUserSelect.bind(this)}>Name Check</button>
          </div>
);
    }
}

What is JSX ?

The XML syntax inside JavaScript is called JSX. Just like XML, JSX tags have tag name, attribute and Children.
JSX code by itself cannot be read by the browser; it must be transpiled into traditional JavaScript using tools like Babel and webpack.

Thursday, 17 August 2017

What is React.Js ?

1.React is a JavaScript library created by Facebook for building complex, interactive user interfaces in web and Desktop applications.

2.React uses virtual DOM which is JavaScript object. This improves application performance as JavaScript virtual DOM is faster than the regular DOM.

3.It follows the component based approach which helps in building reusable UI components.

What is diffing algorithm?

  React needs to use algorithms to find out how to efficiently update the UI to match the most recent tree. The diffing algorithms is genera...