You are on page 1of 7

Strict mode

- All of the above

Methods to re render component

- setState, forceUpdate

3 to preserve components context of this in handler

- Primer, tercera y cuarta

4how can you call the renderProfile function inside the render method in JSX

- {this.renderProfile()}

5 Reduce bundle size

- All of the above webpack, express plugin, lazy.

6 Check which code works fine Have to re check problems with answers

7 Which are true for state and props

- Both influence how component is rendered ,


- props get passed to the component similar to function parameters ,
- state is managed and scoped within a component, similar to variables declared within a
function

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

9 why would you use React.Children.map instead of children.map

- React.children.map will handle the case when props.children is null or undefined


- Props.children, map throws an error when props.children is not an array

10 what is the correct way to pass the parameter id to handleclick

A, d,

- () =>this.handleclick(id)
- , this.handleclick.bind(this,id)

11 stateless component is correct statement


- Stateless components are written as js functions,
- sc are used to build reusable pieces of presentariton ui

12 you want to define default values for props input to Reactcomponent , what method to used.

- GetDefaultProps

13 where do you use hoc select all that apply

- 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

14 similarities between react and vue

- Sacarla mal

15 method is NOT called when component is created or while initially inserting a component into
the dom?

- getDerivedStateFromProps

Is INCORRECT about replaceState()-

- Using replaceState() the current and previous states are merged

17 INCORRECT way to use React without rendering HTML.

- Returning undefined

18 CORRECT statements regarding componentWillMount method.

- All of the above.

What happens when the following render() method is executed

- it displays the list of languages in the array

20 which of the following component click could trigger a ui update.


21 INCORRECT statements about uncontrolled components.

- 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

What would be displayed by the following code

- Nothing, needs single tag to wrap everything

23 <Router> components provided by React Router library

- BROWSER ROUTER

24 how to access React Routers librarys props (match, history, location)?

- 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

27 which of the following statements about state in React are INCORRECT.


28 what is the second argument that can optionally be passed to setState and what is its purpose?

- 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 correctly describes the data flow of flux?

- Action, dispatcher, store, view

Which of the following contains the correct order of lifecycle methods in mounting?
Analyze the code below and answer the following question

What will happen when you use setState() in componentWillMount()

How can you prevent re rendering a total component if it hasn’t changed ?

- Using reacts pure component

You are using React v.16.8 to develop a web application. How can you handle window resizing ?

- Use useLayoutEffect hook to handle resize listener

You are assigned to monitor and improve application performance. Which of the following
strategies will work well?

- All of the above


Which of the following statements are TRUE about the two ReactJS code segments below?

- Both of the above define components in react


- The second segment uses an ES6 class to define a component

Which of the following are TRUE about routing in React?

- It keeps the UI in sync with the URL

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

Which of the following statements about componentDidUpdate is CORRECT?

- componentDidUpdate() is invoked inmmediately after updating occurs. This method is not


called for the initial render.
- The return value from getSnapshotBeforeUpdate() will be passed as the third parameter
to componentDidUpdate()

You need to render a component when the browser is resized. How can you do that?

- None of the above

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()

You might also like