简体   繁体   中英

Highlight some dates in react calendar

hello i have this calendar in my project, i want to highlight some date to mark that they are already used. can you tell me how to do that please ?

import React, { useState} from 'react';
import Calendar from 'react-calendar';

export default function Test() {
  const [date, setDate] = useState(new Date.toDateString());
  const dateToMark = [
    '3',
    '10',
    '20',
  ];

  return(
    <div>
      <p>{date}</p>
      <Calendar onChange={setDate} value={date}/>
    </div>
  );
}

thanks by advance and have a good code day.

import React, { useState} from 'react';
import Calendar from 'react-calendar';

export default function Test() {
  const [date, setDate] = useState([
    '3',
    '10',
    '20',
  ]);

  return(
    <div>
      <p>{date}</p>
      <Calendar onChange={setDate} value={date}/>
    </div>
  );
}

By passing date like initial value of usestate variable.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM