title: How to Use the Same handleChange Event on Different Components
body: <p>I'm trying to make a function which can disabled textfield when checkbox is checked.</p>
  <p>The function is doing what I wanted, but when I trying to make multiple fields with the same function, the components are just bind together.</p>
  <p>I've tried to handle them with <strong>event.target</strong> but I think I messed it up so I deleted the lines.</p>
  <p>What should I do so they can separated into two components working individually?</p>
  <p>Here's my code:</p>
  <pre><code>import React from 'react';
  import Checkbox from '@material-ui/core/Checkbox';
  import TextField from '@material-ui/core/TextField';
  
  export default function Checkboxes() {
    const [required, setRequired] = React.useState(true);
    const [checked, setChecked] = React.useState(false);
    const [disabled, setDisabled] = React.useState(false);
  
    const handleChange = event =&gt; {
      setRequired(!required);
      setChecked(!checked);
      setDisabled(!disabled);
    };
  
    return (
      &lt;div&gt;
        &lt;form&gt;
          &lt;TextField
            required={required}
            autoComplete=&quot;off&quot;
            id=&quot;standard-required&quot;
            label=&quot;text1&quot;
            disabled={disabled}
          /&gt;
  
          &lt;Checkbox
            label=&quot;cb1&quot;
            checked={checked}
            onChange={handleChange}
            color=&quot;primary&quot;
          /&gt;
        &lt;/form&gt;
        &lt;form&gt;
          &lt;TextField
            required={required}
            autoComplete=&quot;off&quot;
            id=&quot;standard-required&quot;
            label=&quot;text1&quot;
            disabled={disabled}
          /&gt;
  
          &lt;Checkbox
            label=&quot;cb1&quot;
            checked={checked}
            onChange={handleChange}
            color=&quot;primary&quot;
          /&gt;
        &lt;/form&gt;
      &lt;/div&gt;
    );
  }
  
  </code></pre>
  <p>Here's my sandbox:
  <a href="https://stackblitz.com/edit/react-ts-3zvmp5?file=demo.tsx" rel="nofollow noreferrer">https://stackblitz.com/edit/react-ts-3zvmp5?file=demo.tsx</a></p>