Where communities thrive


  • Join over 1.5M+ people
  • Join over 100K+ communities
  • Free without limits
  • Create your own community
People
Repo info
Activity
  • Feb 07 2017 07:55
    darthtrevino closed #47
  • Feb 07 2017 07:50
    darthtrevino opened #47
  • Feb 07 2017 04:18
    darthtrevino closed #46
  • Feb 07 2017 04:13
    darthtrevino opened #46
  • Jan 25 2017 22:24
    darthtrevino closed #45
  • Jan 25 2017 22:18
    darthtrevino closed #37
  • Jan 25 2017 22:18
    darthtrevino edited #45
  • Jan 25 2017 22:17
    darthtrevino opened #45
  • Jan 25 2017 22:14
    darthtrevino synchronize #37
  • Jan 25 2017 20:22
    darthtrevino closed #41
  • Jan 25 2017 20:19
    darthtrevino closed #44
  • Jan 25 2017 20:19
    darthtrevino closed #40
  • Jan 25 2017 06:59
    darthtrevino edited #44
  • Jan 25 2017 06:59
    darthtrevino closed #34
  • Jan 25 2017 02:44
    darthtrevino edited #44
  • Jan 25 2017 02:44
    darthtrevino edited #44
  • Jan 24 2017 23:14
    darthtrevino synchronize #44
  • Jan 24 2017 23:02
    darthtrevino edited #44
  • Jan 24 2017 22:59
    darthtrevino edited #44
  • Jan 24 2017 22:58
    darthtrevino synchronize #44
Dan Abramov
@gaearon
I made a separate room for dnd-core! Promise not to spam you. :-)
Kir Belevich
@deepsweet
:scream_cat:
Michael Scott Hertzberg
@moimikey
:+1:
Art Semyonov
@artps
(poke)
Nathan Hutchision
@nelix
yay
Toni Laukka
@tonilaukka
How do you handle dnd and recursion inside the component where the component calls itself?
Toni Laukka
@tonilaukka
@DragSource(ItemTypes.CHILD, childSource, collectDrag)
@DragTarget(ItemTypes.CHILD, childTarget, collectDrop)
class Child extends Component {

  constructor(props) {
    this.state = {
      children: [1,2,3,4]
    }
  }

  render() {
    const { connectDragSource, connectDropTarget, isDragging } = this.props

      return connectDragSource(connectDropTarget(
        <ul>
          {this.state.children.map((child, i) =>
            <li key={child}>
              <Child index={i} ref={'child/' + i} />
            </li>
          )}
        </ul>
      ))
  }
}
This throws an error: "Unhandled promise rejection TypeError: connectDropTarget is not a function(...)"
Toni Laukka
@tonilaukka
@DragSource(ItemTypes.CHILD, childSource, collectDrag)
@DragTarget(ItemTypes.CHILD, childTarget, collectDrop)
class Child extends Component {

  constructor(props) {
    this.state = {
      children: [1,2,3,4]
    }
  }

  render() {
    const { connectDragSource, connectDropTarget, isDragging } = this.props

      return connectDragSource(connectDropTarget(
        <ul>
          {this.state.children.map((child, i) =>
            <li key={child}>
              <HigherChild index={i} ref={'child/' + i} />
            </li>
          )}
        </ul>
      ))
  }
}

const HigherChild = 
    DragSource(ItemTypes.CHILD, childSource, collectDrag)(
    DragTarget(ItemTypes.CHILD, childTarget, collectDrop)(Child))