Created
April 8, 2017 14:09
-
-
Save wesleytodd/04f70d66d730c874c9d67302d6a4a3ad to your computer and use it in GitHub Desktop.
This file contains hidden or 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
var oldRefs = parseInt(React.version.split('.')[0], 10) < 14; | |
function refCompatibilitySet (refName) { | |
if (oldRefs) { | |
return refName; | |
} | |
return function (ref) { | |
this['__ref' + refName] = ref; | |
}; | |
} | |
function refCompatibilityGet (component, refName) { | |
if (oldRefs) { | |
return component.refs[refName] && component.refs[refName].getDOMNode(); | |
} | |
return component['__ref' + refName]; | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment