I have a react component called react-dropzone
. It allows you to drag and drop files, which then invokes a function (usually you "do" something with the file, but you can have it invoke any function you please).
When a file is dropped, I want to route the client to 'page-redirect'. The following code has no errors, but does nothing.
import React, { Component } from "react";
import Dropzone from "react-dropzone";
import { BrowserRouter as Router, Route } from "react-router-dom";
import PageRedirect from "./pages/page-redirect.jsx";
class DragAndDrop extends Component {
//function invoked by the Dropzone Component
handleOnDrop = files => {
console.log(files);
return (
<Router>
<Route exact path="/pages/page-redirect" component={PageRedirect} />
</Router>
);
};
render() {
return (
<div>
<Dropzone onDrop={this.handleOnDrop}> Drop File Here </Dropzone>
</div>
);
}
}
export default DragAndDrop;
Any insight is greatly appreciated!