Member-only story

Top React Hooks — Calendar, Form, and API

John Au-Yeung
3 min readOct 7, 2020

--

Photo by Estée Janssens on Unsplash

Hooks contains our logic code in our React app.

We can create our own hooks and use hooks provided by other people.

In this article, we’ll look at some useful React hooks.

react-uniformed

The react-uniformed package lets us create forms with ease.

To install it, we run:

npm install --save react-uniformed

or:

yarn add react-uniformed

to install it.

Then we can use it by writing:

import React from "react";
import { useForm, useSettersAsEventHandler } from "react-uniformed";
export default function App() {
const { setValue, values, submit } = useForm({
onSubmit: data => console.log(data)
});
const handleChange = useSettersAsEventHandler(setValue); return (
<>
<form onSubmit={submit}>
<label>Name</label>
<input name="name" value={values.name} onChange={handleChange} />
<button>Submit</button>
</form>
</>
);
}

We created a basic form with the form element.

--

--

No responses yet