Created
April 8, 2022 10:42
-
-
Save MarwanShehata/1131fe85c23c07d0275a7e0964dc5d3c to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import "./App.css"; | |
function App() { | |
// const handleIt = (e: any, v: number) => { | |
// console.log(e, v) | |
// } | |
const handleIt = (v) => { | |
return (e) => { | |
console.log(e, v); | |
}; | |
}; | |
// use currying to clean your code | |
return ( | |
<div className="App"> | |
{/* <input onChange={(e)=> handleIt(e, 1)} /> */} | |
{/* <input onChange={(e)=> handleIt(e, 2)} /> */} | |
{/* <input onChange={(e)=> handleIt(e, 3)} /> */} | |
<input onChange={handleIt(1)} /> | |
<input onChange={handleIt(2)} /> | |
<input onChange={handleIt(3)} /> | |
</div> | |
); | |
} | |
export default App; |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment