// function component in reactimportReactfrom'react';constFunctionComponent=function(){return(<div><h1>ReactFunctionComponent</h1></div>)}exportdefaultFunctionComponent;
importReact,{ useState }from'react';functionExample(){// Declare a new state variable, which we'll call "count"const[count, setCount]=useState(0);return(<div><p>You clicked {count} times</p><button onClick={()=>setCount(count +1)}>+</button><button onClick={()=>setCount(count -1)}>-</button></div>);}exportdefaultExample;
importReactfrom'react';constApp=()=>{const greeting ='Hello Function Component!';return<Headline value={greeting}/>;};constHeadline=({ value })=><h1>{value}</h1>;exportdefaultApp;