10 ms·
> If I'm managing the state of, say, a form, and I want the submit button to be disabled when (condition), the obvious solution is to add `disabled={condition}`
by rimunroe 6y ago
> If I'm managing the state of, say, a form, and I want the submit button to be disabled when (condition), the obvious solution is to add `disabled={condition}`, rather than a conditional className or attribute to then match on in css.
I'm confused, are you saying you would prefer to disable the submit button without adding the `disabled` attribute?
- withinboredom 6y agoThey're probably talking about the :disabled pseudo-selector.
- smichel17 6y agoHmm, good point. I was trying to simplify a real-world example to shorten it, but ended up with something nonsensical. I was starting to share a better example but then realized I have other things I ought to do right now… I have it saved, will come back if I have more time later.