rpm3948
rpm3948

Reputation: 3

Override class of underlying React component

I'm using an existing React component (i.e. Paginate) which itself makes use of some components (ie. Button). Currently, the Button component sets its class to 'X' which is defined in a css file. I'd like to override the properties of 'X' when I'm using the Paginate component. Is there a way this can be done?

Upvotes: 0

Views: 355

Answers (1)

MegaTron
MegaTron

Reputation: 3393

I haven't used react, but could you possibly stick a parent div around the paginate component and reference the css as .parent .x { attributes }?

Alternatively, you could provide your own over ride CSS file that's loaded after the react styles.

.parent .x {
  /* news styles */
}
<div class="parent">
  <div class="paginate">
    <div class="x"> x </div>
  </div>
</div>

Upvotes: 1

Related Questions