Answers for "react style in components"

27

inline style react

// You are actuallty better off using style props
// But you can do it, you have to double brace
// and camel-case the css properties
render() {
	return (
    	<div style={{paddingTop: '2em'}}>
      		<p>Eh up, me duck!</p>
      	</div>
    )
}
Posted by: Guest on March-14-2020
0

react style tag

const MyStyledComponent = props =>
  <div className="styled">
    Hover for red
    <style dangerouslySetInnerHTML={{__html: `
      .styled { color: blue }
    `}} />
  </div>
Posted by: Guest on May-17-2022

Code answers related to "Javascript"

Browse Popular Code Answers by Language