Created
July 16, 2015 20:19
-
-
Save rymohr/310285338c44b6f8cba2 to your computer and use it in GitHub Desktop.
How I wish I could write React components
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 DreamList extends React.Component { | |
// Would love to be able to write inline SCSS/LESS | |
// and have it automatically injected into the document | |
// when the component was required. | |
<style> | |
.dream-list { | |
margin: 0; | |
padding: 0; | |
list-style: none; | |
} | |
.dream-list-item { | |
transition: opacity .5s; | |
opacity: .5; | |
&:hover, | |
&:active, | |
&.active { | |
opacity: 1; | |
} | |
} | |
</style> | |
// And this is a minor one, but it would be nice | |
// to be able to use "class" instead of "className" | |
// and have the JSX transpiler convert it for me. | |
render () { | |
return ( | |
<ul class="dream-list"> | |
<li class="dream-list-item">One</li> | |
<li class="dream-list-item">Two</li> | |
</ul> | |
); | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment