Junior — Senior
Logging controlled and uncontrolled form field values in React on submit
livecode
Task condition
It is necessary to output to the console the values of form fields, implemented as controlled using useState and as uncontrolled via ref, upon the submit event.
export default () => {
const handleSubmit() => {
console.log("First input value: ");
console.log("second input value: ");
};
return (
<form onClick-(handleSubmit)>
<input placeholder-"controlled field" />
<input placeholder="uncontrolled field" />
<button>Submit a credit application</button>
</form>
)
}