-
Notifications
You must be signed in to change notification settings - Fork 2k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
React examples do not work #1085
Comments
I'm also having trouble getting plugins working in typescript. @arturi, can you share what behavior / errors you're experiencing? |
It's important not to create the const uppy = Uppy()
.use(...)
const AvatarPicker = () => {
return (
<DragDrop uppy={uppy} ... />
)
} Otherwise, you can use a class component with lifecycle methods. class AvatarPicker extends React.Component {
constructor(props) {
super(props)
this.uppy = Uppy()
.use(...)
}
componentWillUnmount() {
// important to do this when not using a global shared instance,
// it cleans up event listeners and the like
this.uppy.close()
}
render() {
return <DragDrop uppy={this.uppy} />
}
} |
Just for the sake of documentation. You can create Uppy inside a functional component using the Check out this SO question: |
@pedrofs thanks! would you be able to send a PR for https://uppy.io/docs/react/dashboard/#Initializing-Uppy with a short example and a link to SO? |
I have tried to implement Uppy in my React app by following the Uppy React docs, with no success. The DragDrop component is drawn, but after selecting a file none of the events fire. In my example code below you'll see numerous event handlers trying to output something, but as mentioned, nothing logs after selecting a file.
The app uses React 16.4.1 with Typescript 2.9. Uppy versions as follows
upload.tsx:
The text was updated successfully, but these errors were encountered: