Skip to content
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 compatibility #15

Closed
klusurf opened this issue Feb 19, 2018 · 2 comments
Closed

React compatibility #15

klusurf opened this issue Feb 19, 2018 · 2 comments

Comments

@klusurf
Copy link

klusurf commented Feb 19, 2018

Are there any examples on how to integrate LMDD (which I think is fantastic) with React? Or do you know of any compatible React wrappers out there?
Thanks!

@jlarmstrongiv
Copy link

I’m also curious about integrating with React

Angular and React integration is pretty much the same, examples will be added to this section later on.

The readme mentions examples will be added later on. In the meantime, a quick codesandbox would be really helpful if anyone could whip one up 🙂

@supraniti
Copy link
Owner

supraniti commented May 14, 2018

i have taken a small 'todo app' from code-pen and integrated it with lmdd
you can find the modified example here:
https://codepen.io/supraniti/pen/OZZGeB
and the original pen is here:
https://codepen.io/marekdano/pen/bVNYpq

integration steps:

  1. i added a ref on the app main render function (ref="lmdd")
    this is for accessing the dom element and setting up the lmdd instance
  2. i added the setup functin and an event listener on componentDidMount() hook
    using the ref from step 1 to locate the dom element,
    initializing lmdd instance with my desired settings
  3. this is enough for the drag and drop functionality to take place, but we also want to update the component state after each succesful drag event, so i also added an event listener and a callback function to update the component state after each succesful drag operation
    and that's about it...

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants