How can I disable a whole section of a form in TypeScript/React?
Body:
I'm building a form in TypeScript (using React), and I want to disable an entire section of the form — similar to how Stack Overflow disables part of the UI when needed.
I tried adding disabled or aria-disabled to a , but it doesn't seem to have any effect, since those attributes don't actually disable interaction on non-interactive elements like divs.
Right now, I'm conditionally rendering the "disabled state" using something like:
{isDisabled ? (
{/* disabled form section */}
) : (
{/* active form section */}
)}
This works, but it feels a bit hacky or repetitive.
Is there a cleaner or more idiomatic way to "disable" an entire section of a form in React/TypeScript — ideally without having to set disabled manually on every single input?
Any suggestions or best practices would be appreciated.