It is maintained by Facebook along with the developer community. It is great especially if you are working on single page application and wish to make it fast, responsive and user-friendly.
- ReactJs is very comfortable with SEO. You can easily run your ReactJs with the servers.
- It ensures faster rendering.
- Its component-based approach and well-defined life-cycle are very simple to use.
- It comes with a developer toolset. React Developer Tools is a browser extension available for both Chrome and Firefox.
1.What is React?
2.What do you understand by Props and State in React?
In a React component, props are variables passed to it by its parent component. It is how Components get their properties. They are pure i.e immutable. They are always passed down from parent to child component and they are also used to render dynamic data.
State is also variables, but directly initialized and managed by the component. They determine components rendering and behavior. They are immutable and create dynamic and interactive components. State is accessed using this.state(). We can update the state using this.setState().
3.What are the features of React?
->It does server-side rendering(the ability of an application to contribute by displaying the web-page on the server instead of rendering it in the browser).
->It follows Uni-directional data flow.
4.List few advantages of using React over other front-end libraries and frameworks
->React comes with a good supply of documentation,tutorials and training resources, hence easy to learn and use.
->React is based on components which have a large advantage as each component has its own logic and controls its own rendering,and can be reused whenever we need them.
->React has great Developer tools. React Developer Tools,available for Chrome and Firefox, is a browser extension for React.It allows us to inspect the React component hierarchies in the Virtual DOM.
->React can be used on client as well as server side.
5.What is JSX?
6.Why do we need to transpile JSX before our file gets to the web browser?
7.How can you differentiate React from Angular?
->React is a library, whereas Angular is an entire framework.
->React uses the Virtual DOM, whereas Angular still uses the Real DOM.
->React uses one-way data binding whereas Angular uses two way data binding.
8.Name the Lifecycle Methods of React components and explain them:
-> componentWillMount(): executed just before renderingboth on client and server-side.
-> componentDidMount(): executed after first render only on the client side.
-> componentWillRecieveProps(): invoked as soon as the props are received from parent class before another render is called.
-> shouldComponentUpdate(): Returns true or false based on certain conditions.
-> componentWillUpdate(): called just before rendering takes place.
-> componentDidUpdate(): called just after rendering takes place.
-> componentWillUnmount(): called after the component is unmounted from the DOM.
9.What are components in React?
Components are the building blocks of React application's UI. It splits the UI into reusable components and renders each piece independently. Every component has a render() function, which returns a single React element which is the representation of the native DOM component.
10.What is the difference between Stateful and Stateless Components?
-> Stateful Components keep track of the changing data. They store information about components state change in memory.
-> Stateless Components calculate the internal state of the components. They contain no information about the changes in state.
11.What are Event handlers in React?
Event Handlers help us to create responsive web applications that respond to the user. This way React keeps track of every action that is performed by the user.
Eg:- Resizing a window,clicking a link,scrolling through a page etc.
12.Explain refs in React?
refs stands for References. It is used to return references to a particular element or component returned by render(). For focus management,text selection,media playback and trigger animation we use refs in React.
13.What are pure components?
They are the simplest and the fastest components. They render the same output for the same state and props.
14.Explain the significance of keys in React
In React, Keys are unique identifiers. They are used to identify which items have changed, updated and deleted from the Lists. They are used to identify unique Virtual DOM Elements with their corresponding data driving the UI.
15.How is data shared between components in React?
In React, data is shared between components using state and props. This can also be achieved by employing callbacks, using Redux or even by utilizing the React Context API.