A Simple, Beautiful And Reusable Date Picker Component For React

Category: React React DatePicker | June 27, 2021
Author: Hacker0x01
Official Page: Go to website
Last Update: June 27, 2021
License: MIT


A simple, beautiful and reusable Date Picker for React, which will give you the flexibility to create either Date Picker Or Time Picker in your React application.

How can I use it?

First install the component using NPM.

npm install react-datepicker --save

Or you can install it with Yarn.

yarn add react-datepicker

Then, import the component like this.

import React, { useState } from "react";
import DatePicker from "react-datepicker";
import "react-datepicker/dist/react-datepicker.css";

Code usage:

const Example = () => {
  const [startDate, setStartDate] = useState(new Date());
  return (
    <DatePicker selected={startDate} onChange={(date) => setStartDate(date)} />