Below is some sample React code. Be sure to insert your own Organization’s API key and an Importer ID from your account. They can be found on the Importers page.
Note for Next.js users: This code can be used for Next.js versions lower than 14. For Next.js versions 14 and 15, add "use client"
to the first line of the file.
import FuseImporter from "fuse-importer";
import React from "react";
const App = () => {
const showImporter = () => {
const importer = new FuseImporter();
importer.getSessionToken = ... // see https://fuse-docs.flatirons.com/getting-started/sessions
importer.onSubmit = async (records) => {
return {
message: "Data imported successfully",
errors: {}
};
};
importer.onValidateRecord = async (record) => {
return { errors: {}, warnings: {} };
};
importer.show();
};
return (
<>
<button onClick={showImporter}>Show Importer</button>
</>
);
};
export default App;