'How to update Rule property value in JSS 10.9.0

I'm trying to dynamically update a rule in JSS.

I'd like to set the hover background color. According to the docs, it should be:

sheet.getRule('a').prop('propSelector', 'new value')

There doesn't seem to be a prop attribute on the (Base)Rule object, at least in version 10.9.0.

Here are some JSS styles:

newsImage: {
    cursor: 'pointer',
    backgroundColor: data => data.newsImage.backgroundColor,
    '&:hover': {
      backgroundColor: blue
    },
    '&:focus': {
      'border-color': '#CCCCCC'
    }
  }

I figured out a way to update a value in the JSS Rules object using this code:

this.stylesheet.getRule('newsImage').style['height'] = '5rem';

But that has no effect on the style sheet that is attached to the DOM.

Does anyone know if there is another way to set a property without a function?



Sources

This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.

Source: Stack Overflow

Solution Source