imagekit-developer/imagekit-react

It is hard to customize behaviour of IKUpload component

Closed this issue · 2 comments

Hi there,

I faced with an architectural issue. I would like to upload images only when user press save button so I don't need to build infrastructure to clean-up images that are not in use (not linked to any resourtce in DB). Unfortunately, I haven't found a way to do it using the provided component. I believe, there is a need to split views and business logic into separate things. It would be nice to have a hook like useIKUploader() => {upload: () => void, validate: () => boolean, ....} instead of passing ref and initiating upload by clicking.

Let me know your thoughts.

Hello, React SDK internally uses our javascript SDK. You can directly use the upload function of JS SDK.

Within React app either do import ImageKitJS from "imagekit-javascript" or use IKCore component exposed via React SDK.

Just for those who is curious.
I create a small package to address this issue: https://www.npmjs.com/package/react-imagekit-hooks