Events management
omponent have a lot of events that you can use to hook into the component's lifecycle. You can find a list of all events on this page.
Events types
You can handle the following events from the component:
progress
- The upload progress event. The event detail is the upload progress in percentage.success
- The upload success event. The event detail is the upload result.error
- The upload error event. The event detail is the error message.
Code example
export function App() {
const token = 'WEB3STORAGE_APIKEY';
function onSuccess(e) {
console.log(e.detail);
}
return (
<>
<div/>
<web3-upload-btn
token={token}
isdisplayresult={true}
isdisplaytoast={true}
onClick={onSuccess}></web3-upload-btn>
<div />
</>
);
}
export default App;