I'll show ith an example how inline CSS works in React
App.js
import React, { Component } from 'react';
import './App.css';
class App extends Component {
render() {
const style = {
backgroundColor: 'white',
font: 'inherit',
border: '1px solid blue',
padding: '8px',
cursor: 'pointer',
borderRadius: '6px'
};
return (
<div className="App">
<button style={style}>SWITCH</button>
</div>
);
}
}
export default App;
App.css
.App {
text-align: center;
}
Above example shows both, CSS from CSS file and inline CSS in React
Comments
Post a Comment