I'm facing an issue with a component that contains four radio inputs in a group. One of them is coded like this:
<div className="answer3 col-sm">
<label>
<input
type="radio"
id="answer1"
name="answer"
value="A"
checked={this.state.selectedOption === "A"}
onChange={this.onValueChange}
/>
<img src="./images/answer1.png" alt="answer A" />
</label>
</div>
Even though the onChange method successfully updates the state and the correct input value is logged in the console, I'm experiencing a problem where my custom style for checked radio buttons is not being applied. The CSS for the style (used as a test) looks like this:
input[type="radio"]:checked {
background-color: rgb(117, 17, 17);
}
I suspect that this issue might be related to the dynamic addition of the "checked" attribute bypassing the normal application of styles by CSS. Could this be the cause of the problem?