简体   繁体   中英

changing styles in different components in react

How can I change styles of Side component when onChange a Link of All component?

enter image description here

enter image description here

You can do it dynamically by change a state and doing it on onChange handler on an input element like this:

const [show , setShow] = useState(false)

<input onChange={(value)=>{
   setShow(true)
}} />

<div className={show ? "classA" :  "classB"} >
...
</div>

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM