Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

Commit 20928fb

Browse files
authored
Update README.md
1 parent 62232f0 commit 20928fb

File tree

1 file changed

+54
-0
lines changed

1 file changed

+54
-0
lines changed

‎README.md‎

Lines changed: 54 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -374,5 +374,59 @@ class MyComponent extends React.PureComponent{
374374
375375
---
376376
377+
### 16. How Virtual-DOM is more efficient than Dirty checking?
378+
379+
In React, each of our components have a state. This state is like an observable. Essentially, React knows when to re-render the scene because it is able to observe when this data changes. Dirty checking is slower than observables because we must poll the data at regular intervals and check all of the values in the data structure recursively. By comparison, setting a value on the state will signal to a listener that some state has changed, so React can simply listen for change events on the state and queue up re-rendering.
380+
381+
The virtual DOM is used for efficient re-rendering of the DOM. This isn’t really related to dirty checking your data. We could re-render using a virtual DOM with or without dirty checking. In fact, the diff algorithm is a dirty checker itself.
382+
383+
We aim to re-render the virtual tree only when the state changes. So, using an observable to check if the state has changed is an efficient way to prevent unnecessary re-renders, which would cause lots of unnecessary tree diffs. If nothing has changed, we do nothing.
384+
385+
**[Back to Top](https://github.com/aatul/ReactJS-and-Redux-Questions-Answers/blob/master/README.md#table-of-contents)**
386+
387+
---
388+
389+
### 17. What is FLUX in ReactJs?
390+
391+
Flux is an application architecture in React View Library which is designed by Facebook for creating data layers in an application based on JavaScript.
392+
393+
**[Back to Top](https://github.com/aatul/ReactJS-and-Redux-Questions-Answers/blob/master/README.md#table-of-contents)**
394+
395+
---
396+
397+
### 18. What are the refs in React?
398+
399+
For focus management, trigger animation we use refs in React. It also contains third party libraries.
400+
401+
**[Back to Top](https://github.com/aatul/ReactJS-and-Redux-Questions-Answers/blob/master/README.md#table-of-contents)**
402+
403+
---
404+
405+
### 19. What is the stable version of ReactJs?
406+
407+
Version: 15.5
408+
409+
**[Back to Top](https://github.com/aatul/ReactJS-and-Redux-Questions-Answers/blob/master/README.md#table-of-contents)**
410+
411+
---
412+
413+
### 20. Is setState() async? Why is setState() in React Async instead of Sync?
414+
415+
setState() actions are asynchronous and are batched for performance gains. setState() does not immediately mutate this.state but creates a pending state transition. Accessing this.state after calling this method can potentially return the existing value. There is no guarantee of synchronous operation of calls to setState and calls may be batched for performance gains.
416+
417+
This is because setState alters the state and causes rerendering. This can be an expensive operation and making it synchronous might leave the browser unresponsive. Thus, the setState calls are asynchronous as well as batched for better UI experience and performance.
418+
419+
**[Back to Top](https://github.com/aatul/ReactJS-and-Redux-Questions-Answers/blob/master/README.md#table-of-contents)**
420+
421+
---
422+
423+
### 21. What is render() in React? And explain its purpose?
424+
425+
Each React component must have a ```render()``` mandatorily. It returns a single React element which is the representation of the native DOM component. If more than one HTML element needs to be rendered, then they must be grouped together inside one enclosing tag such as ```<form>```, ```<group>```, ```<div>``` etc. This function must be kept pure i.e., it must return the same result each time it is invoked.
426+
427+
**[Back to Top](https://github.com/aatul/ReactJS-and-Redux-Questions-Answers/blob/master/README.md#table-of-contents)**
428+
429+
---
430+
377431
### Wish you all the luck
378432

0 commit comments

Comments
(0)

AltStyle によって変換されたページ (->オリジナル) /