Search
 
SCRIPT & CODE EXAMPLE
 

JAVASCRIPT

input hook react

function useInput({ type /*...*/ }) {
   const [value, setValue] = useState("");
   const input = <input value={value} onChange={e => setValue(e.target.value)} type={type} />;
   return [value, input];
 }
  const [username, userInput] = useInput({ type: "text" });
 const [password, passwordInput] = useInput({ type: "text" });

 return <>
   {userInput} -> {username} <br />
   {passwordInput} -> {password}
 </>;
Comment

PREVIOUS NEXT
Code Example
Javascript :: Limit number of selected chekboxes 
Javascript :: jquery check if all elements hidden 
Javascript :: what is express static 
Javascript :: javascript string reverse 
Javascript :: isodate mongodb nodejs 
Javascript :: JS cast a Number into a String 
Javascript :: angular chartjs align legend left 
Javascript :: before unload 
Javascript :: JavaScript Sorting Arrays 
Javascript :: multiple ternary operator javascript 
Javascript :: addition of time in javascript 
Javascript :: ngif react 
Javascript :: ionic not compiling with proxy 
Javascript :: pass parameter to javascript function onclick 
Javascript :: s3.getobject nodejs example 
Javascript :: cy.contains 
Javascript :: server mail 
Javascript :: react select options 
Javascript :: Each then() should return a value or throw 
Javascript :: one signal api to send notification 
Javascript :: angular formatting numbers with -commas 
Javascript :: array delete 
Javascript :: jquery onchange get element 
Javascript :: find second largest number in array javascript 
Javascript :: how to uninstall nodejs web server 
Javascript :: Get Parameters Of URL As A String 
Javascript :: convert text to qr code in angular 
Javascript :: react form validation 
Javascript :: axios put api in componentDidMount React 
Javascript :: merge two singly linked lists 
ADD CONTENT
Topic
Content
Source link
Name
1+7 =