Question - What are hooks in React?
Answer -
Hooks are the new feature introduced in React 16.8 version that facilitates us to use state and other React features without writing a class.
See the following example of useState hook:
import { useState } from 'react';
function Example() {
// Declare a new state variable, which we'll call "count"
const [count, setCount] = useState(0);
return (
You clicked {count} times
Click on this button
);
}