@schedule-x/react
Advanced tools
Comparing version
@@ -56,3 +56,6 @@ 'use strict'; | ||
function useCalendarApp(config, plugins) { | ||
const [calendarApp] = react.useState(() => calendar.createCalendar(config, plugins)); | ||
const [calendarApp, setCalendarApp] = react.useState(null); | ||
react.useEffect(() => { | ||
setCalendarApp(calendar.createCalendar(config, plugins)); | ||
}, []); | ||
return calendarApp; | ||
@@ -59,0 +62,0 @@ } |
@@ -54,3 +54,6 @@ import { jsx, Fragment, jsxs } from 'react/jsx-runtime'; | ||
function useCalendarApp(config, plugins) { | ||
const [calendarApp] = useState(() => createCalendar(config, plugins)); | ||
const [calendarApp, setCalendarApp] = useState(null); | ||
useEffect(() => { | ||
setCalendarApp(createCalendar(config, plugins)); | ||
}, []); | ||
return calendarApp; | ||
@@ -57,0 +60,0 @@ } |
@@ -1,6 +0,4 @@ | ||
import { CalendarApp, CalendarConfig } from '@schedule-x/calendar'; | ||
import { PluginBase } from '@schedule-x/shared'; | ||
export declare function useCalendarApp<Plugins extends PluginBase<string>[]>(config: CalendarConfig, plugins?: Plugins): CalendarApp & { [Name in Plugins[number]["name"]]: Extract<Plugins[number], { | ||
name: Name; | ||
}>; }; | ||
import { CalendarApp, CalendarConfig } from "@schedule-x/calendar"; | ||
import { PluginBase } from "@schedule-x/shared"; | ||
export declare function useCalendarApp<Plugins extends PluginBase<string>[]>(config: CalendarConfig, plugins?: Plugins): CalendarApp | null; | ||
export declare function useNextCalendarApp<Plugins extends PluginBase<string>[]>(config: CalendarConfig, plugins?: Plugins): CalendarApp | undefined; |
@@ -18,3 +18,3 @@ { | ||
"types": "dist/types/index.d.ts", | ||
"version": "2.21.1", | ||
"version": "2.21.2", | ||
"type": "module", | ||
@@ -21,0 +21,0 @@ "files": [ |
Sorry, the diff of this file is not supported yet
15897
0.97%266
2.7%