Issue
This is my react render function
render:function(){
return (
<div>
<p className="rr">something</p>
<style>
.rr{
color:red;
}
</style>
</div>
)
}
This gives me this error
JSX: Error: Parse Error: Line 22: Unexpected token :
What's wrong here? Can I embed full normal css into a react component?
Solution
JSX is only a small extension to javascript, it's not its own full blown templating language. So you would do it like in javascript:
return (
<div>
<p className="rr">something</p>
<style>{"\
.rr{\
color:red;\
}\
"}</style>
</div>
)
However there is absolutely no good reason to do this at all.
Answered By - Esailija
0 comments:
Post a Comment
Note: Only a member of this blog may post a comment.