2022-05-24
Hello developer!, glad to see you again.
This is a react-curve, open source project where I can share and start creating small UI components in the way I understood the concepts to build large scale projects .
This week we created a Disable Button app. When the data changes, we handle it and disable the button in react.
To create a DisableButton component; We have to :
import React, {useState} from 'react';
const DisableButton = () => {
const [value, setValue] = useState("");
return (
<div>
<h2>Handle Input</h2>
<input
type="text"
placeholder="Enter Your Title"
value={value}
onChange={(e) => setValue(e.target.value)}
/>
<button disabled={value.length < 1}>
Submit
</button>
<p>{value}</p>
</div>
);
}
export default DisableButton;
Thank you for reading and any contribution is more than welcome in the threads below!