Skip to content
Advertisement

react set style value to unset

A component has right and bottom css properties that are set using a classname. And I wanted to overide those values using the style prop. But so far I could set numerical values like 10px or 0px and others, but was unable to set it to unset.


So what can I do to set them to `unset`? So far I tried this
<CTAButton position="relative" style={{right:"", bottom:""}}/>

And

<CTAButton position="relative" style={{right:null, bottom:null}}/>

Or

<CTAButton position="relative" style={{right:undefined, bottom:undefined}}/>

Which all failed. How can I do this?

Advertisement

Answer

<CTAButton position="relative" style={{right:"unset", bottom:"unset"}}/>

unset can be applied to any CSS property, including the CSS shorthand all. Just my suggestion but I am sure that it is allright. Thanks.

User contributions licensed under: CC BY-SA
3 People found this is helpful
Advertisement