Loading

Quipoin Menu

Learn • Practice • Grow

Direction: Choose the correct option

Q1.

What is a custom hook in React?
A. A hook for customizing components
B. A hook that is built into React
C. A JavaScript function that uses other hooks and starts with 'use'
D. A hook that can only be used in class components
Direction: Choose the correct option

Q2.

Why would you create a custom hook?
A. To reuse stateful logic across multiple components
B. To replace Redux
C. To create new JSX syntax
D. To avoid using state
Direction: Choose the correct option

Q3.

Can a custom hook use other hooks?
A. Only useEffect
B. Only useState
C. No, custom hooks cannot use other hooks
D. Yes, it can use useState, useEffect, etc.
Direction: Choose the correct option

Q4.

What is the naming convention for custom hooks?
A. Must be camelCase
B. Any name is fine
C. Must end with 'Hook'
D. Must start with 'use'
Direction: Choose the correct option

Q5.

Consider a custom hook useWindowWidth. What should it return?
A. The current window width
B. A ref
C. An object with width and height
D. A function to set width