i'm studying about React but don't understand the JSX Styles. here code.
<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8">
<script crossorigin src="https://unpkg.com/react@16/umd/react.production.min.js"></script>
<script crossorigin src="https://unpkg.com/react-dom@16/umd/react-dom.production.min.js"></script>
<script crossorigin src="https://cdnjs.cloudflare.com/ajax/libs/babel-standalone/6.26.0/babel.min.js"></script>
</head>
<body>
<div id="disp"></div>
<script type="text/babel">
var root = document.querySelector('#disp')
const cssStyle = {
'color': 'red',
'backgroud-color': '#fff0f0',
'font-size':'2em'
}
const scriptStyle = {
color: 'blue',
backgroundColor: '#fff0f0',
fontSize: '2em'
}
function getDOM() {
return (
<div>
<div style={scriptStyle}>
Look at the stars
</div>
<p stlye={cssStyle}>
Look how they shine for you
</p>
</div>
)
}
ReactDOM.render(getDOM(), root)
</script>
</body>
</html>
Issue
scriptStyle is good but I can not see cssStyle normally. [object object] so how can I?
stlyeinstead ofstyle. Alsobackgroud-colorinstead ofbackground-color