Question:I have a list from backend. This list is displaying the user’s invoices. I want the button to be disabled if the user doesn’t select at least one invoice. If the user selects at least 1 invoice, I want the button to be active. But the invoices and the button are in different components.
Here the IDE warns me like this; ‘setEnabledButton’ is assigned a value but never used.
Answer:First set default state for your useState function :
Like this :
If you have better answer, please add a comment about this, thank you!