在 redux 应用程序中初始化然后更新 textarea 值。

Initializing then updating textarea value in redux app.

在我的渲染函数中我有

     <textarea value={ this.props.song.client_lyrics }
               onKeyUp={ (event) => this.props.editLyrics(event.target.value) } >
     </textarea>

通常 editLyrics 函数会发送更新 client_lyrics 的操作。但是因为我有 value = { this.props.song.client_lyrics } 而不是 event.target.value 发送初始值 + 我输入的内容,它只继续发送原始 client_lyrics ,它只是保持设置 client_lyrics对自己。

如何使用值初始化文本区域,然后向其添加更多字符,以便 client_lyrics 道具实际发生变化?

textArea

上使用 onChange 而不是 onKeyUp 事件
  <textarea value={ this.props.song.client_lyrics }
           onChange={ (event) => this.props.editLyrics(event.target.value) } >
 </textarea>