issue with updating textarea state?
See original GitHub issueI’ve modified the getting started code to keep it as minimal as possible:
Expected behavior
When I click reset, I’m expecting the textarea’s value to be an empty string:
Actual behavior
Steps to reproduce behavior
Use this code to get the buggy application to work:
const choo = require('choo')
const html = require('choo/html')
const app = choo()
app.model({
state: { title: 'Not quite set yet' },
reducers: {
update: (data, state) => ({ title: data }),
reset: (data, state) => ({ title: '' })
}
})
const mainView = (state, prev, send) => html`
<main>
<h1>Title: ${state.title}</h1>
<textarea
type="text"
oninput=${(e) => send('update', e.target.value)}
>${state.title}</textarea>
<button onclick=${(e) => send('reset')}>reset</textarea>
</main>
`
app.router((route) => [
route('/', mainView)
])
const tree = app.start()
document.body.appendChild(tree)
Add value=${state.title}
to the textarea
to get the desired behaviour.
Issue Analytics
- State:
- Created 7 years ago
- Comments:13 (7 by maintainers)
Top Results From Across the Web
ReactJS component textarea not updating on state change
I'm trying to write a note taking/organizing app and I've run into a frustrating bug. Here's my component: import React from ' ...
Read more >TextArea and TextField change of state not updating the value
Basically what i am trying to do is to reset the text input inside TextArea component. The code is simple. Which i am...
Read more >dcc.Textarea - Dash for Python Documentation - Dash Plotly
dcc.Textarea. dcc.Textarea is a wrapper around the <textarea//> HTML component. It is similar to dcc.Input except that it allows for multiple lines of...
Read more >Forms - React
In HTML, form elements such as <input> , <textarea> , and <select> typically maintain their own state and update it based on user...
Read more >React TextArea value not automatically updating as expected ...
To resolve this issue, make sure that you're passing a "non-undefined" value to the textareas value prop which will cause the textarea element...
Read more >Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start FreeTop Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Top GitHub Comments
@emanchado odd, yeah can confirm. Still seems like a
morphdom
issue - would you mind raising it there?edit: requirebin link
@maximilianschmitt a morphdom patch was released 18 hours ago (you posted it 10 hours ago) - maybs it got fixed?