import'./App.css';importReact from 'react';import{useState,useEffect} from 'react'importButton from './component/Button'import{Inbut} from './component/inbut';import{ClearButton} from './component/ClearButton'import* as math from 'mathjs';import{ re } from 'mathjs';constApp=()=>{const[inbutText ,setInbutText]=useState('');const addToInbut=(val)=>{
setInbutText(val +inbutText)}const handelEqials=()=>{
setInbutText(eval(inbutText))}return(<div className='app'><div className='calc-waraper'><Inbut inbut={inbutText}/><div className='row'><Button handleClick={addToInbut}>7</Button><Button handleClick={addToInbut}>8</Button><Button handleClick={addToInbut}>9</Button><Button handleClick={addToInbut}>/</Button></div><div className='row'><Button handleClick={addToInbut}>4</Button><Button handleClick={addToInbut}>5</Button><Button handleClick={addToInbut}>6</Button><Button handleClick={addToInbut}>x</Button></div><div className='row'><Button handleClick={addToInbut}>1</Button><Button handleClick={addToInbut}>2</Button><Button handleClick={addToInbut}>3</Button><Button handleClick={addToInbut}>+</Button></div><div className='row'><Button handleClick={addToInbut}>.</Button><Button handleClick={addToInbut}>0</Button><Button handleClick={()=>handelEqials()}>=</Button><Button handleClick={addToInbut}>-</Button></div><ClearButton handleClick={()=>{setInbutText('')}}>Clear</ClearButton></div></div>)}exportdefaultApp;
السؤال
Mohamed Lamin Mahmoudi
1 جواب على هذا السؤال
Recommended Posts
انضم إلى النقاش
يمكنك أن تنشر الآن وتسجل لاحقًا. إذا كان لديك حساب، فسجل الدخول الآن لتنشر باسم حسابك.