Skip to content

Can't Nest React Components Within Hammer #91

@choxi

Description

@choxi

I'm trying to nest another React component within the Hammer component:

import React from "react"
import Hammer from "react-hammerjs"

class Note extends React.Component {
  render() {
    let style = { height: "50px", width: "50px", background: "blue" }

    return <div className="Note" style={ style } >
      { this.props.name }
    </div>
  }
}

export default class App extends React.Component {
  handleTap(...args) {
    alert("tap")
  }

  render() {
    return <Hammer onTap={ (...args) => this.handleTap(...args) }>
      <Note />
    </Hammer>
  }
}

... and I get this error:

image

It works fine unless I use another React component inside of <Hammer>.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions