I am trying to change toolbar background color as #fff
color when body scrolled.Otherwise it will be transparent
.
Here is sample toolbar component:
export default class ToolBar extends React.Component {
constructor(props){
super(props)
this.state = {
scrolled:false
}
}
render() {
const { children, className,scrolled, ...other } = this.props
return (
<nav style={{backgroundColor:this.state.scrolled?'#fff':'transparent'}}>
{children}
</nav>
)
}
}
How can we do this with react?