JS Implementations
React CSV Importer
How to implement a React CSV Importer
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.
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;