React.js CSV Importer
How to implement a React.js CSV Importer in minutes.
Below is some sample React code. Be sure to insert your own Organization's API key and a Template ID from your account. They can be found on the Templates page.
import FuseImporter from "fuse-importer";
import React from "react";
const App = () => {
const showImporter = () => {
const organizationApiKey = "YOUR ORGANIZATIONS API KEY";
const templateId = "YOUR TEMPLATE ID";
if (
organizationApiKey.indexOf("YOUR") !== -1 ||
templateId.indexOf("YOUR") !== -1
) {
window.confirm(
"You need to configure your organization api key and template id."
);
return;
}
const importer = new FuseImporter(organizationApiKey, templateId);
importer.onSubmit = async (records) => {
return {
message: "Data imported successfully",
errors: {}
};
};
importer.onValidateRecord = async (record) => {
return {};
};
importer.show();
};
return (
<>
<button onClick={showImporter}>Show Importer</button>
</>
);
};
export default App;
Copy link