Tuesday, 25 April 2017

React JS Interview Questions and Answers

React JS Interview Questions and Answers

Question: What is ReactJS?
React is front end library developed by Facebook.


Question: Why ReactJS is used?
React is used to handle the view part of Mobile application and Web application.


Question: Does ReactJS use HTML?
No, It uses JSX which is simiar to HTM.


Question: When ReactJS released?
March 2013


Question: What is current stable version of ReactJS?
Version: 16.2.0
Release on: November 28, 2017


Question: What is Repository URL of ReactJS?
https://github.com/facebook/react



Question: What are the life Cycle of ReactJS?
  1. Initialization
  2. State/Property Updates
  3. Destruction



Question: What are the feature of ReactJS?
  1. JSX: JSX is JavaScript syntax extension.
  2. Components : React is all about components.
  3. One direction flow: React implements one way data flow which makes it easy to reason about your app



Question: What are the Advantages of ReactJS?
  1. React uses virtual DOM which is JavaScript object. This will improve apps performance
  2. It can be used on client and server side
  3. Component and Data patterns improve readability.
  4. Can be used with other framework also.



Question: How to embed two components in One component?
import React from 'react';
class App extends React.Component {
   render() {
      return (
         <div>
            <Header/>
            <Content/>
         </div>
      );
   }
}

class Header extends React.Component {
   render() {
      return (
         <div>
            <h1>Header</h1>
         </div>
      );
   }
}

class Content extends React.Component {
   render() {
      return (
         <div>
            <h2>Content</h2>
            <p>The content text!!!</p>
         </div>
      );
   }
}

export default App;