Reputation: 77
I have 2 input values named Budget and Earning, so I want Budget to be entered only if it is less than Earning, otherwise no.
How should I condition them: can we use a ternary operator here?
<BudgetInput value={BudgetInputValue}>
<EarningInput value={EarningInputValue}>
Upvotes: 1
Views: 252
Reputation: 7162
You can use the disabled prop in the input element...and add the condition like:
disabled={BudgetInput >= EarningInput}
Upvotes: 1