Loading

Quipoin Menu

Learn • Practice • Grow

react / Event Binding in React
mcq
Direction: Choose the correct option

Q1.

Why do you need to bind event handlers in class components?
A. Because React requires it
B. To improve performance
C. Because class methods are not bound to the instance by default
D. To pass arguments
Direction: Choose the correct option

Q2.

Which of the following is NOT a way to bind an event handler?
A. Using event.bind(this)
B. Binding in constructor: this.handleClick = this.handleClick.bind(this)
C. Using an arrow function as class property: handleClick = () => {}
D. Using an arrow function in render: onClick={() => this.handleClick()}
Direction: Choose the correct option

Q3.

What is a potential downside of using arrow functions in render (e.g., onClick={() => this.handleClick()})?
A. It creates a new function on every render, which may cause unnecessary re-renders in child components
B. It binds to the wrong context
C. It doesn't work
D. It's slower than bind
Direction: Choose the correct option

Q4.

In a functional component, do you need to bind event handlers?
A. Yes, always
B. Only if using this
C. Only for class components
D. No, because functions are already bound to the component scope
Direction: Choose the correct option

Q5.

What is the recommended way to bind handlers in a class component to avoid performance issues?
A. Bind in render
B. Use inline binding
C. Use arrow functions in render
D. Bind in constructor or use class property arrow functions