Я хочу продемонстрировать модуль FilePond в приложении React, загрузив простой файл. У меня есть образец CodePen:
https://codepen.io/rikschennink/pen/WXavEx
Если вы перейдете на вкладку «Настройки», а затем на вкладку «JavaScript», вы сможете найти множество внешних сценариев / перьев, добавленных в этот проект CodePen. Мой вопрос: как мы можем переписать этот файл JS ниже в файл React и как мы можем определить зависимости, которые будут установлены?
/*
We want to preview images, so we need to register the Image Preview plugin
*/
FilePond.registerPlugin(
// encodes the file as base64 data
FilePondPluginFileEncode,
// validates the size of the file
FilePondPluginFileValidateSize,
// corrects mobile image orientation
FilePondPluginImageExifOrientation,
// previews dropped images
FilePondPluginImagePreview
);
// Select the file input and use create() to turn it into a pond
FilePond.create(
document.querySelector('input')
);