Professional Documents
Culture Documents
- setState, forceUpdate
4how can you call the renderProfile function inside the render method in JSX
- {this.renderProfile()}
6 Check which code works fine Have to re check problems with answers
8 in order to improve performance, how do you prevent function from being called too many
times over the duration of a lifetime.
- Debouncing ,
- Throttling
A, d,
- () =>this.handleclick(id)
- , this.handleclick.bind(this,id)
12 you want to define default values for props input to Reactcomponent , what method to used.
- GetDefaultProps
- Reusing no duplicating code to inject the same type of logic or functionality into multiple
different components
- Connecting, sharing and manipulating application state across multiple components
- Injecting a set of props into multiple different components
- Sacarla mal
15 method is NOT called when component is created or while initially inserting a component into
the dom?
- getDerivedStateFromProps
- Returning undefined
- Uncontrolled components control input elements through changes to external state only
when the user inputs new data
- An uc has its form data directly handled by a parent component instead of completely
controlled by itself
- BROWSER ROUTER
- withRouter,
- useHistory
25 you need nested components to use data provided by another component the is much higher
in the hierarchy , how can you avoid prop drilling. ONLY ONE
-Redux
- React context
26 which of the following are pointer events that are available in ReactDOM?
- onGotPointerCapture,
- onLostPointerCapture
- A callback function to run after the state update has been applied
29 Which methods are called when the state or props of a Component is changed?
- shouldComponentUpdate()
- render()
- componentDidUpdate()
30 which of the following is a correct way to apply class attributes conditionally on the value of
this.props.visible ?
Which of the following contains the correct order of lifecycle methods in mounting?
Analyze the code below and answer the following question
You are using React v.16.8 to develop a web application. How can you handle window resizing ?
You are assigned to monitor and improve application performance. Which of the following
strategies will work well?
Which of the following statements about the Error Boundaries in React are correct?
- Error boundaries are components that can catch JavaScript errors anywhere in the child
component tree, log those errors and display a fallback UI instead of the component tree
that crashed.
- A class component becomes an error boundary if it defines a new lifecycle method called
componentDidCatch(error, info) or static getDerivedStateFromError()
What type of React component should you use to allow for uploading a file from a users
filesystem?
- An uncontrolled component
You need to render a component when the browser is resized. How can you do that?
You want to display an image on the page. What is the correct way to use the value of
this.props.image in the src attribute of the <img> element?
Which method is called right before rendering the elements in the DOM?
- getDerivedStateFromProps()