Skip to content

Conversation

@gwu
Copy link
Contributor

@gwu gwu commented Feb 28, 2017

ReactDOM.findDOMNode() is discouraged, so we use refs instead (https://facebook.github.io/react/docs/react-dom.html#finddomnode).
This allows us to use this in our server-side render correctly.

ReactDOM.findDOMNode() is discouraged, so we use refs instead.
This allows us to use this in our server-side render correctly
@JedWatson
Copy link
Owner

Really neat solution, thanks @gwu

}, this);

var self = this;
props.ref = function(domElement) {

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@JedWatson @gwu
cc @silentcloud
This PR will cause two problem:

  1. break change, see below use case, the children's string ref will be override by Hammer
        <Hammer
          direction="DIRECTION_HORIZONTAL"
          onPanStart={this.onPanStart}
          onPan={this.onPan}
          onPanEnd={this.onPanEnd}
        >
          <div className={`${prefixCls}-content`} ref="content">
            {children}
          </div>
        </Hammer>
  1. cause react warning: https://facebook.github.io/react/warnings/special-props.html

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

+1 Yes this is breaking ref for child components

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

#87

paranoidjk referenced this pull request in react-component/react-hammerjs May 16, 2017
moretti added a commit to marvelapp/react-hammerjs that referenced this pull request Feb 26, 2018
moretti added a commit to marvelapp/react-hammerjs that referenced this pull request Feb 26, 2018
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

Successfully merging this pull request may close these issues.

6 participants