Last active
August 20, 2022 18:24
-
-
Save guylaor/31d859f91bd5e601fccb to your computer and use it in GitHub Desktop.
Using CSS transform: translate(...) with ReactJS
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
render: function() { | |
var cleft = 100; | |
var ctop = 100; | |
var ctrans = 'translate('+cleft+'px, '+ctop+'px)'; | |
var css = { | |
transform: ctrans | |
} | |
return ( | |
<div style={css} /> | |
) | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Here's another way that worked for me: