onesine / react-tailwindcss-datepicker

Modern date range picker component for React using Tailwind 3 and dayjs. Alternative to Litepie Datepicker.
https://react-tailwindcss-datepicker.vercel.app/
MIT License
551 stars 169 forks source link

How do I update Documentation? #177

Open heecheon92 opened 1 year ago

heecheon92 commented 1 year ago

In the doc, demo code shows as follow:

import React, {useState} from "react"; 
import Datepicker from "react-tailwindcss-datepicker"; 

const App = () => { 
  const [value, setValue] = useState({ 
    startDate: null 
    endDate: null 
  }); 

  const handleValueChange = (newValue) => {
    console.log("newValue:", newValue); 
    setValue(newValue); 
  } 

  return (
    <Datepicker 
    value={value} 
    onChange={handleValueChange} 
    showShortcuts={true} 
    /> 
  );
}; 
export default App;

But using "strict" type-checking option enabled, above code doesn't work.

I suggest following demo code to be updated on the doc.

import React, {useState} from "react"; 
import Datepicker, { DateValueType } from "react-tailwindcss-datepicker";

const App = () => { 
    const [date, setDate] = useState<DateValueType>(null);

  return (
    <Datepicker 
           i18n={"ko"}
           asSingle={true}
           useRange={false}
           value={date}
           onChange={setDate}
    /> 
  );
}; 
export default App;

version: "react-tailwindcss-datepicker": "^1.6.6"