Answers for "Basic Implementation of RC Upload plugin with custom upload handler"

0

Basic Implementation of RC Upload plugin with custom upload handler

import Upload from "rc-upload";
import { useState } from "react";

export default function App() {
  const [myFile, setMyFile] = useState();

  const uploadProps = {
    data: { a: 1, b: 2 },
    customRequest({ file, data }) {
      console.log("file", file);
      console.log("data", data);
      setMyFile(file.uid);
    }
  };

  return (
    <div className="App">
      <h1>Hello CodeSandbox</h1>
      <h2>Start editing to see some magic happen!</h2>
      <Upload {...uploadProps}>
        <button>ciao</button>
      </Upload>
      <div>{myFile}</div>
    </div>
  );
}
Posted by: Guest on March-09-2022

Code answers related to "Basic Implementation of RC Upload plugin with custom upload handler"

Browse Popular Code Answers by Language