setNext
Appends a handler to the end of the calendar's event bus chain. Used to attach a data provider so that add-event, update-event, and delete-event actions forward to a backend after the store handlers run.
Usage
setNext(handler: any): any;
Each call adds another link in the chain. RestDataProvider and other providers are valid handlers.
Example
import { Calendar, RestDataProvider } from "@svar-ui/react-calendar";
const provider = new RestDataProvider("/api");
const events = await provider.getData();
const init = (api) => {
api.setNext(provider);
};
export default function App() {
return <Calendar events={events} date={new Date()} init={init} />;
}
Related articles
RestDataProvider— turn-key REST handler attached viasetNext.init— typical place to callsetNext.on— listen to actions after the provider runs.- Saving to a backend — full data-provider wiring.