React Interview Questions and Answers
Related differences
Ques 21. How is routing in React different from conventional routing?
Differences between the conventional routing and the routing in React can be shown using the following aspects:
- Pages: Each view is considered as a new file in conventional routing while it is considered as a single HTML entity in React.
- Navigation: In conventional routing, users have to move across web pages for viewing. In React, the views are not refreshed as objects are re-issued to create new views.
Ques 22. Can AJAX be used with React?
Yes, any AJAX library, such as Axios and jQuery AJAX, can be used with React easily. One important thing is to maintain the states of the components, and here too, the props are passed from the parents to the child components.
Child components still cannot send back props to parents, and this factor greatly increases rendering efficiency when dynamic data is considered.
Ques 23. What is the meaning of synthetic events in React?
Synthetic events in React are objects that act as cross-browser wrappers, allowing for the use of native events. This is done to ensure that a variety of browsers can run the API and that the event contains all properties.
Ques 24. What are stateful components in React?
Stateful components are entities that store the changes that happen and place them into the memory. Here, the state can be changed, alongside storing information such as past, current, and future changes.
Ques 25. What are refs in React?
‘Refs’ is short for references in React. Refs are used to store a reference to a single React element or a React component. This is later returned using the render function.
They are mainly used in the following scenarios:
- To initiate imperative animations
- To join third-party DOM libraries
- To manage focus and apply media playback
Most helpful rated by users: