React Interview -1
React Interview -1
Interview
Q&A
SHAIKH ROMAN
Q1: How does React work?
Answer:
SHAIKH ROMAN
Q3: What are the major features of ReactJS?
Answer:
SHAIKH ROMAN
This reactProp (or whatever you came up with) name then
becomes a property attached to React's native props object
which originally already exists on all components created
using React library.
props.reactProp;
SHAIKH ROMAN
Managing focus, text selection, or media playback
Triggering imperative animations.
Integrating with third-party DOM libraries.
SHAIKH ROMAN
Q6: What is Context API in ReactJS?
Answer:
SHAIKH ROMAN
SHAIKH ROMAN
Q7: What are the advantages of ReactJS?
Answer:
Hooks are a new addition in React 16.8. They let you use state and
other React features without writing a class. With Hooks, you can
extract stateful logic from a component so it can be tested
independently and reused
SHAIKH ROMAN
Hooks allow you to reuse stateful logic without changing your
component hierarchy. This makes it easy to share Hooks
among many components or with the community.
Answer:
SHAIKH ROMAN
Q10: What is the difference between a
Presentational component and a Container
component?
Answer:
SHAIKH ROMAN
Q11: What are the differences between a Class
component and Functional component?
Answer:
Class Components
Functional Components
SHAIKH ROMAN
Functional Components mainly focuses on the UI of the
application, not on the behavior.
To be more precise these are basically render function in
the class component.
Functional Components can have state and mimic
lifecycle events using Reach Hooks
Answer:
SHAIKH ROMAN
Props (short for properties) are a Component's
configuration. They are received from above and
immutable as far as the Component receiving them is
concerned. A Component cannot change its props, but it is
responsible for putting together the props of its child
Components. Props do not have to just be data - callback
functions may be passed in as props.
Answer:
Refs are an escape hatch which allow you to get direct access
to a DOM element or an instance of a component. In order to
use them you add a ref attribute to your component whose
value is a callback function which will receive the underlying
DOM element or the mounted instance of the component as
its first argument.
SHAIKH ROMAN
Above notice that our input field has a ref attribute whose
value is a function. That function receives the actual DOM
element of input which we then put on the instance in order to
have access to it inside of the handleSubmit
function.
It’s often misconstrued that you need to use a class
component in order to use refs, but refs can also be used with
functional components by leveraging closures in JavaScript.
SHAIKH ROMAN
Q14: When rendering a list what is a key and
what is it's purpose?
Answer:
SHAIKH ROMAN
Q19: What are Fragments in React?
Answer:
SHAIKH ROMAN
There is also a shorter syntax: