Step 1: Installation
npm install --save radium
Step 2: Include Radium as follows
Step 5: Change hover values
npm install --save radium
Step 2: Include Radium as follows
import Radium from 'radium';
Step 3: Change from
export default App;
to
export default Radium(App);
Step 4: Add hover to style variable that defines inline css
const style = {
backgroundColor: 'green',
color: 'white',
':hover': {
backgroundColor: 'lightgreen',
color: 'black'
}
};
if(this.state.persons.length > 0) {
style.backgroundColor = 'red';
style[':hover'] = {
backgroundColor: 'salmon',
color: 'black'
}
}
Comments
Post a Comment