Validation with multiple base classes done

This commit is contained in:
Lucas Oliveira 2023-02-17 16:59:41 -03:00
commit ddb648dcbf
8 changed files with 28 additions and 21 deletions

View file

@ -1,11 +1,16 @@
export default function Input({onChange}){
import { useState } from "react";
export default function Input({value, onChange}){
const [myValue, setMyValue] = useState(value ?? "");
return (
<>
<input
type="text"
value={myValue}
className="block w-full form-input rounded-md border-gray-300 shadow-sm focus:border-indigo-500 focus:ring-indigo-500 sm:text-sm"
placeholder="Type a text"
onChange={(e) => {
setMyValue(e.target.value);
onChange(e.target.value);
}}
/>