import React, { useState } from "react";
function FormInput(params) {
const [name, setName] = useState("Input Value");
function onChangeEvent(element) {
//console.log(element.target.value);
console.log(element.target.placeholder);
console.log(element.target.type);
setName(element.target.value);
}
return (
<div>
<input
type={params.type}
placeholder={params.placeholder}
onChange={onChangeEvent}
/>
{name}
</div>
);
}
export default FormInput;
Preview:
downloadDownload PNG
downloadDownload JPEG
downloadDownload SVG
Tip: You can change the style, width & colours of the snippet with the inspect tool before clicking Download!
Click to optimize width for Twitter