TrypicalDev
TrypicalDev

Reputation: 111

Conditinal style class in reactjs

There is default style class, Need to override its elements with another class, check the image below.

How can I achieve this?

enter image description here

Upvotes: 0

Views: 30

Answers (1)

Rahul Sharma
Rahul Sharma

Reputation: 10111

You should destructure after condition, not before condition.

<div style={{
    ...local,
    ...(src ? customLogo: {})
}}>

Upvotes: 2

Related Questions