aboutsummaryrefslogtreecommitdiffstats
path: root/public/projects/react-small-apps/apps/todos/src/components/forms/TextArea/TextArea.js
blob: 78a10b6819a24491dbdd9b118e42aa9ca6b4df53 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
function TextArea({ label, id, value, updateValue }) {
  const handleChange = (e) => {
    updateValue(e.target.value);
  };

  return (
    <>
      {label ? (
        <label htmlFor={id} className="form__label">
          {label}
        </label>
      ) : (
        ""
      )}
      <textarea
        value={value}
        onChange={handleChange}
        className="form__field form__field--textarea"
      />
    </>
  );
}

export default TextArea;