jsx中添加动态样式:style

jsx中添加动态样式:style

// style后第一大括号表示这是一个表达式,表达式内部是一个对象
const h11 = (<h1 className='title' style={{color:'red',backgroundColor: true ? 'pink' : 'cyan'}}>jsx处理样式</h1>);


ReactDom.render(h11,document.getElementById('root'))

你可能感兴趣的:(前端,javascript,开发语言)