quantum icon indicating copy to clipboard operation
quantum copied to clipboard

Dynamic input value only being respected on first render.

Open gabriel-almeida-andrade opened this issue 4 years ago • 4 comments

When I have a dinamic input value like this:

<Input value={text} />

The input initial value will respect text variable, but if text change, the input value won't change accordingly.

Example:

import { Input } from '@catho/quantum';
import { useState } from 'react';

const Test = () => {
  const [text, setText] = useState('Initial text');
  const clickHandler = () => {
    setText('Another text');
  };

  return (
    <>
      <h1>{text}</h1>
      <button type="button" onClick={clickHandler}>My Button</button>
      <Input type="text" value={text} />
    </>
  );
};

export default Test;

gabriel-almeida-andrade avatar Aug 05 '20 14:08 gabriel-almeida-andrade

Hi there! Here is me, again. 😄 Can I get this one, now?! I think I know what is happening here.

alisson-suzigan avatar Oct 14 '20 22:10 alisson-suzigan

Hi there! Here is me, again. smile Can I get this one, now?! I think I know what is happening here.

just do it @alisson-suzigan! :smile:

tcelestino avatar Oct 15 '20 02:10 tcelestino

This issue was resolved by @alisson-suzigan PR. Thanks!! :1st_place_medal:

rapahaeru avatar Oct 28 '20 12:10 rapahaeru

Problem still persists on ẗhis date

iagocaldeira avatar Dec 23 '20 16:12 iagocaldeira

Boa rapha! 🙌

iagocaldeira avatar Jul 25 '23 02:07 iagocaldeira