Created
July 12, 2016 20:14
-
-
Save andersekdahl/23c63e7a976d0af7a7f858f84ff4074b to your computer and use it in GitHub Desktop.
findDOMNode
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
class Editable extends React.Component { | |
componentDidMount() { | |
const node = ReactDOM.findDOMNode(this); | |
// Do stuff with the DOM node to make both React and | |
// the CMS we use happy | |
} | |
render() { | |
if (this.props.Component) { | |
return <this.props.Component {...this.props} />; | |
} else { | |
return <div>{this.props.content}</div>; | |
} | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment