import * as React from "react"; import { useEffect } from "react"; import { useState } from "react"; import ReactDom from "react-dom"; import Cal, { getCalApi } from "./src/index"; const api = getCalApi(); function App() { const [loaded, setLoaded] = useState(false); useEffect(() => { // Simulate state change causing config object to change, causing rerender of Cal setTimeout(setLoaded.bind(true), 1000); const callback = (event) => { console.log(event.detail); }; api.then((api) => { api("on", { action: "*", callback, }); api("ui", { cssVarsPerTheme: { light: { "cal-border-booker": "red", "cal-border-booker-width": "20px", }, dark: { "cal-border-booker": "red", "cal-border-booker-width": "5px", }, }, }); }); return () => { api.then((api) => { api("off", { action: "*", callback, }); }); }; }, []); return ( <>

There is Cal component below me

); } ReactDom.render(, document.getElementById("root"));