useState

PHOTO EMBED

Sun Mar 12 2023 07:15:08 GMT+0000 (Coordinated Universal Time)

Saved by @bhushan03 #javascript

//USe.jsx file , this file export to App.jsx and run this file

import React,{useState} from 'react';


const use=()=>{
  const[store_age,update_age]=useState(19);
  const handle=()=>{
    update_age(store_age+2);
    
  }

  return(
    <div className="main">
  <h1>toadya ia am {store_age} old</h1>
  <button onClick={handle} > get oldder </button>

    </div>
  )
}
export default use;
content_copyCOPY