How to get and modify an input value that has already been rendered

Viewed 19

When the update button is pressed, the disable attribute of input is false, so I want to get the previously rendered value and make it modified, but it doesn't work.

How Can i Handle it??..

const [updateTitle, setUpdateTitle] = useState('');

const onUpdateTitle = (e) => {
setUpdateTitle(e.target.value);
}; 


     <div className='wrap-items'>
        {list
          .sort((a, b) => b.id - a.id)
          .map((item) => (
           (...)
                  <p className='title'>

                    {/* Already rendered data, but no idea to handle change value */}                        
                    <input
                      type='text'
                      onChange={onUpdateTitle}
                      value={item.title}
                      disabled={editId !== item.id}
                    />
                  </p>
           (...)
          ))}
      </div>
0 Answers
Related