useEffect Hook in ReactJs
App.js:
import React from 'react';
import { useState } from 'react';
import { useEffect } from 'react';
import './App.css'
function App()
{
const [count, setCount]=useState(0)
useEffect(()=>{console.warn("useEffect")})
return(
<div className='App'>
<h1>useEffect in React {count}</h1>
<button onClick={()=>setCount(count+1)}>Update Counter</button>
</div>
)
}
export default App;
Comments
Post a Comment