--- title: FileDrop tags: visual,input,state,effect,event,intermediate --- Renders a file drag and drop component for a single file. * Create a ref called `dropRef` for this component. * Use the `React.useState()` hook to create the `drag` and `filename` variables, initialized to `false` and `''` respectively. The variables `dragCounter` and `drag` are used to determine if a file is being dragged, while `filename` is used to store the dropped file's name. * Create the `handleDrag`, `handleDragIn`, `handleDragOut` and `handleDrop` methods to handle drag and drop functionality, bind them to the component's context. * Each of the methods will handle a specific event, the listeners for which are created and removed in the `React.useEffect()` hook and its attached `cleanup()` method. * `handleDrag` prevents the browser from opening the dragged file, `handleDragIn` and `handleDragOut` handle the dragged file entering and exiting the component, while `handleDrop` handles the file being dropped and passes it to `props.handleDrop`. * Return an appropriately styled `