get current component name reactjs hooks code example
Example 1: declaring multiple state variables in react
function ExampleWithManyStates() {
// Declare multiple state variables!
const [age, setAge] = useState(42);
const [fruit, setFruit] = useState('banana');
const [todos, setTodos] = useState([{ text: 'Learn Hooks' }]);
// ...
}
Example 2: how to use hooks react
const App = () => {
const [students , setStudents] = useState([]);
return (
// put in the jsx code here
)
}