In my application, in React i have next situation:
I have input where i add different values when i click on save. The value from input is converted from string to array.
So, first time i added a text, i clicked save, and i have 1 value in array.
Second time, i add another text, i click, on save and the first value is changed by second.
I store value in this state:
const [value, setValue] = useState([here comes my value]);
I want to concat the value one after one and i did:
useEffect(()=> {
setAllValues([...value, value])
}, [value])
..but this does't work. How to store all values in one array?
setAllValueswhere your function name issetValue