version
Description
Current Gantt package versionThe version constant exports the current version of the Gantt package used in your project.
It is primarily intended for use with the export service, allowing you to construct a versioned export endpoint that guarantees compatibility between the client-side Gantt and the server-side export service.
You can import the component from "@svar-ui/react-gantt":
import { version } from "@svar-ui/react-gantt";
The version value always matches the installed Gantt package version.
Example
The example below shows how to provide a URL to a ready-to-use export service within the export-data action | PRO feature. Gantt sends its state to that service, which generates and returns the file.
import { useState } from "react";
import { Gantt, version } from "@svar/react-gantt";
function MyComponent({ tasks, links }) {
const [api, setApi] = useState(null);
function exportToExcel() {
if (!api) return;
api.exec("export-data", {
url: "https://export.svar.dev/gantt/" + version,
format: "xlsx",
filename: "gantt.xlsx"
});
}
return (
<Gantt
init={setApi}
tasks={tasks}
links={links}
/>
);
}
export default MyComponent;
Related article: Exporting