1.1.1 • Published 11 months ago
@najwer23snacks/form v1.1.1
The Form component is a reusable React functional component designed to handle form submissions in a structured and efficient manner. It encapsulates the logic for managing form data and provides a clean interface for developers to work with.
Install
yarn add @najwer23snacks/form --dev
npm install @najwer23snacks/form --save-dev
Example
import { Form } from "@najwer23snacks/form";
export const Example = () => {
const handleOnSubmit = (formData: Record<string, object>) => {
console.log("Form:", formData)
};
return (
<>
<Form onSubmit={handleOnSubmit}>
<div>
<div><label>Name:</label></div>
<input type="text" id="numberInput" name="name" className='error' />
</div>
<br />
<div>
<div><label>Password:</label></div>
<input type="text" id="password" name="password" />
</div>
<br />
<button type="submit">Submit</button>
</Form>
</>
);
}