Skip to main content

getEvent

Looks up an event in the calendar store by its id. Returns undefined when no event matches.

Usage

getEvent(id: string | number): CalendarEvent | undefined;
ParameterTypeDescription
idstring | numberEvent id to look up

Example

import { useRef } from "react";
import { Calendar } from "@wx/react-calendar";

function App() {
const apiRef = useRef(null);

function logEvent() {
const event = apiRef.current.getEvent(42);
console.log(event);
}

return <Calendar ref={apiRef} events={events} />;
}
  • getEvents — list events in a date range.
  • getState — full state snapshot including selected event.
  • events — the source array getEvent looks up against.