0

I have to files bootstrap-iso.css and public-iso.css and component of name publicRoute which uses public-iso.css as it's base. However I have some parts in publicRoute that want to use bootstrap-iso, but without this public-iso css.

    const PublicRoute = ({ component: Component, sendMail, ...rest }) => {

    //Some code ...

     return(
    <div className="public-iso">

    //Some code ...
    
    <Route {...rest} component={(props) => (

    //Some code ...

    <Component {...props} />

    //Some code ...

    )}
    
    </div>
)}

And this Component have some part which need only bootstrap-iso.

const DirectComponent = () =>{

...Some code

return(
<div className="bootstrap-iso">

...some code

</div>

)}

Which finally leads to situation where:

<div className="public-iso">
   ...
   <div className="bootstrap-iso">
      <DirectComponent/>
   </div>
</div> 

And I know, that I could just add public-iso class to all single components instead of adding it to whole PublicRoute component but it would be too redundant. So how can I exlude DirectComponent from range of public-iso class?

1 Answer 1

1

Excluding won't be possible but you might try overriding the css in this way

.public-iso .bootstrap-iso {
  ----
}

Since it will take higher precedence. Hope it helps.

Sign up to request clarification or add additional context in comments.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.